blackjack rework
parent
c190fa89b2
commit
c99f4bd2c5
|
@ -386,9 +386,21 @@ def execute_blackjack_custom(v, target, body, type):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def execute_blackjack(v, target, body, type):
|
def execute_blackjack(v, target, body, type):
|
||||||
if not execute_blackjack_custom(v, target, body, type): return False
|
if not execute_blackjack_custom(v, target, body, type):
|
||||||
if not body or (not blackjack and not blackjack2): return True
|
return False
|
||||||
if any(i in body.lower() for i in blackjack.split()) or all(i in body.lower() for i in blackjack2.split()):
|
|
||||||
|
if not body: return True
|
||||||
|
|
||||||
|
execute = False
|
||||||
|
if blackjack and any(i in body.lower() for i in blackjack.split()):
|
||||||
|
execute = True
|
||||||
|
shadowban = True
|
||||||
|
elif blackjack2 and any(i in body.lower() for i in blackjack2.split()):
|
||||||
|
execute = True
|
||||||
|
shadowban = v.truescore < 100
|
||||||
|
|
||||||
|
if execute:
|
||||||
|
if shadowban:
|
||||||
v.shadowbanned = AUTOJANNY_ID
|
v.shadowbanned = AUTOJANNY_ID
|
||||||
|
|
||||||
ma = ModAction(
|
ma = ModAction(
|
||||||
|
@ -401,28 +413,25 @@ def execute_blackjack(v, target, body, type):
|
||||||
|
|
||||||
v.ban_reason = "Blackjack"
|
v.ban_reason = "Blackjack"
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
notifs = []
|
elif hasattr(target, 'is_banned'):
|
||||||
extra_info = "unknown entity"
|
target.is_banned = True
|
||||||
|
|
||||||
if type == 'submission':
|
if type == 'submission':
|
||||||
extra_info = f"submission ({target.permalink})"
|
extra_info = target.permalink
|
||||||
elif type == 'comment' or type == 'message':
|
|
||||||
extra_info = f"{type} ({target.permalink})"
|
|
||||||
notifs.append(Notification(comment_id=target.id, user_id=CARP_ID))
|
|
||||||
notifs.append(Notification(comment_id=target.id, user_id=IDIO_ID))
|
|
||||||
elif type == 'chat':
|
elif type == 'chat':
|
||||||
extra_info = "chat message"
|
extra_info = "chat message"
|
||||||
elif type == 'flag':
|
elif type == 'flag':
|
||||||
extra_info = f"reports on {target.permalink}"
|
extra_info = f"reports on {target.permalink}"
|
||||||
elif type == 'modmail':
|
elif type in ('comment', 'message', 'modmail'):
|
||||||
extra_info = "modmail"
|
for id in (CARP_ID, IDIO_ID):
|
||||||
|
n = Notification(comment_id=target.id, user_id=id)
|
||||||
if notifs:
|
g.db.add(n)
|
||||||
for notif in notifs:
|
|
||||||
g.db.add(notif)
|
|
||||||
g.db.flush()
|
g.db.flush()
|
||||||
elif extra_info:
|
extra_info = None
|
||||||
send_repeatable_notification(CARP_ID, f"Blackjack for {v.username}: {extra_info}")
|
|
||||||
send_repeatable_notification(IDIO_ID, f"Blackjack for {v.username}: {extra_info}")
|
if extra_info:
|
||||||
|
for id in (CARP_ID, IDIO_ID):
|
||||||
|
send_repeatable_notification(id, f"Blackjack for @{v.username}: {extra_info}")
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue