Update
This commit is contained in:
parent
96c8a1ab23
commit
b1cf05a125
4 changed files with 12 additions and 7 deletions
|
@ -74,7 +74,9 @@ async def tos_msg_counter(msg: Bot.MessageSession, command: str):
|
|||
async def temp_ban_check(msg: Bot.MessageSession):
|
||||
is_temp_banned = temp_ban_counter.get(msg.target.sender_id)
|
||||
is_superuser = msg.check_super_user()
|
||||
if is_temp_banned and not is_superuser:
|
||||
if is_superuser:
|
||||
await remove_temp_ban(msg.target.sender_id)
|
||||
if is_temp_banned:
|
||||
ban_time = datetime.now().timestamp() - is_temp_banned['ts']
|
||||
if ban_time < TOS_TEMPBAN_TIME:
|
||||
if is_temp_banned['count'] < 2:
|
||||
|
|
|
@ -6,6 +6,9 @@ WARNING_COUNTS = Config('tos_warning_counts', 5)
|
|||
|
||||
|
||||
async def warn_target(msg: Bot.MessageSession, reason=None):
|
||||
is_superuser = msg.check_super_user()
|
||||
if is_superuser:
|
||||
return None
|
||||
if WARNING_COUNTS >= 1:
|
||||
current_warns = int(msg.target.sender_info.query.warns) + 1
|
||||
msg.target.sender_info.edit('warns', current_warns)
|
||||
|
|
|
@ -71,12 +71,12 @@ async def update_assets():
|
|||
ca = random_cache_path()
|
||||
shutil.unpack_archive(download_file, ca)
|
||||
|
||||
with open(os.path.join(ca, 'PhigrosLibrary-master', 'difficulty.csv'), 'r', encoding='utf-8') as f:
|
||||
reader = csv.reader(f)
|
||||
with open(os.path.join(ca, 'PhigrosLibrary-master', 'difficulty.tsv'), 'r', encoding='utf-8') as f:
|
||||
reader = csv.DictReader(f, delimiter='\t')
|
||||
for row in reader:
|
||||
data[row[0].lower()] = {'EZ': row[1], 'HD': row[2], 'IN': row[3]}
|
||||
if len(row) > 4:
|
||||
data[row[0].lower()]['AT'] = row[4]
|
||||
data[row['Name'].lower()] = {'EZ': row['EZ'], 'HD': row['HD'], 'IN': row['IN']}
|
||||
if 'AT' in row:
|
||||
data[row['Name'].lower()]['AT'] = row['AT']
|
||||
|
||||
os.remove(download_file)
|
||||
else:
|
||||
|
|
|
@ -15,7 +15,7 @@ if Config('enable_urlmanager'):
|
|||
@aud.command(['trust <apilink>',
|
||||
'block <apilink>'])
|
||||
async def _(msg: Bot.MessageSession, apilink: str):
|
||||
date = msg.ts2strftime(datetime.now().timestamp(), timezone=False)
|
||||
date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
check = await WikiLib(apilink).check_wiki_available()
|
||||
if check.available:
|
||||
apilink = check.value.api
|
||||
|
|
Reference in a new issue