minor fix

master
Aevann 2023-03-12 10:31:17 +02:00
parent b931e6b7fd
commit 0f62958024
2 changed files with 4 additions and 17 deletions

View File

@ -200,23 +200,10 @@ def execute_blackjack(v, target, body, type):
send_repeatable_notification(id, f"Blackjack by @{v.username}: {extra_info}")
return True
def execute_anti_grooming(v, c, u):
if 'discord' not in c.body and 'groomercord' not in c.body or v.shadowbanned:
def notify_jannies_of_grooming(v, c, u):
if 'discord' not in c.body and 'groomercord' not in c.body:
return
v.shadowbanned = AUTOJANNY_ID
ma = ModAction(
kind="shadowban",
user_id=AUTOJANNY_ID,
target_user_id=v.id,
_note=f'reason: "Grooming @{u.username}"'
)
g.db.add(ma)
v.ban_reason = f"Grooming @{u.username}"
g.db.add(v)
notified_ids = [x[0] for x in g.db.query(User.id).filter(User.admin_level >= PERMS['BLACKJACK_NOTIFICATIONS'])]
for id in notified_ids:

View File

@ -536,7 +536,7 @@ def message2(v:User, username:str):
g.db.flush()
execute_blackjack(v, c, c.body_html, 'message')
execute_under_siege(v, c, c.body_html, 'message')
execute_anti_grooming(v, c, user)
notify_jannies_of_grooming(v, c, user)
c.top_comment_id = c.id
if user.id not in bots:
@ -610,7 +610,7 @@ def messagereply(v:User):
g.db.flush()
execute_blackjack(v, c, c.body_html, 'message')
execute_under_siege(v, c, c.body_html, 'message')
execute_anti_grooming(v, c, user)
notify_jannies_of_grooming(v, c, user)
if user_id and user_id not in {v.id, MODMAIL_ID} | bots:
notif = g.db.query(Notification).filter_by(comment_id=c.id, user_id=user_id).one_or_none()