Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2024-02-18 22:43:50 +08:00 committed by GitHub
parent 96c8a1ab23
commit b1cf05a125
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View file

@ -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:

View file

@ -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)

View file

@ -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:

View file

@ -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