fix 500 error

master
Aevann 2024-05-17 00:55:21 +03:00
parent 2c14d23e7b
commit e17904e938
1 changed files with 13 additions and 11 deletions

View File

@ -73,18 +73,19 @@ def execute_blackjack(v, target, body, kind):
if not execute: return False
v.shadowbanned = AUTOJANNY_ID
if v:
v.shadowbanned = AUTOJANNY_ID
ma = ModAction(
kind="shadowban",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=f'reason: "Blackjack: {kind}"'
)
g.db.add(ma)
ma = ModAction(
kind="shadowban",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=f'reason: "Blackjack: {kind}"'
)
g.db.add(ma)
v.shadowban_reason = f"Blackjack: {kind}"
g.db.add(v)
v.shadowban_reason = f"Blackjack: {kind}"
g.db.add(v)
notified_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['BLACKJACK_NOTIFICATIONS'])]
extra_info = kind
@ -105,7 +106,8 @@ def execute_blackjack(v, target, body, kind):
if extra_info:
for id in notified_ids:
send_repeatable_notification_duplicated(id, f"Blackjack by @{v.username}: {extra_info}")
username = v.username if v else 'AutoJanny'
send_repeatable_notification_duplicated(id, f"Blackjack by @{username}: {extra_info}")
return True
def find_all_emoji_endings(emoji):