remotes/1693045480750635534/spooky-22
Aevann1 2021-10-18 21:06:00 +02:00
parent fcb7c94659
commit ad553141e3
1 changed files with 19 additions and 35 deletions

View File

@ -175,38 +175,6 @@ def buy(v, award):
return {"message": "Award bought!"}
def banaward_trigger(post=None, comment=None):
author = post.author if post else comment.author
link = f"[this post]({post.permalink})" if post else f"[this comment]({comment.permalink})"
if not author.is_suspended:
author.ban(reason=f"one-day ban award used by @{v.username}", days=1)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.")
elif author.unban_utc > 0:
author.unban_utc += 24*60*60
g.db.add(author)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?")
def grass_trigger(post=None, comment=None):
author = post.author if post else comment.author
author.is_banned = AUTOJANNY_ACCOUNT
author.ban_reason = f"grass award used by @{v.username}"
g.db.add(self)
link = f"[this post]({post.permalink})" if post else f"[this comment]({comment.permalink})"
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!")
ACTIONS = {
"ban": banaward_trigger,
"grass": grass_trigger
}
ALLOW_MULTIPLE = (
"ban",
"shit",
@ -263,12 +231,28 @@ def award_post(pid, v):
msg = f"@{v.username} has given your [post]({post.permalink}) the {AWARDS[kind]['title']} Award!"
note = request.values.get("note", "").strip()
if note:
msg += f"\n\n> {note}"
if note: msg += f"\n\n> {note}"
send_notification(NOTIFICATIONS_ACCOUNT, post.author, msg)
if kind in ACTIONS: ACTIONS[kind](post=post)
if kind == "ban":
author = post.author if post else comment.author
link = f"[this post]({post.permalink})" if post else f"[this comment]({comment.permalink})"
if not author.is_suspended:
author.ban(reason=f"one-day ban award used by @{v.username}", days=1)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for a day for {link}. It sucked and you should feel bad.")
elif author.unban_utc > 0:
author.unban_utc += 24*60*60
g.db.add(author)
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended for yet another day for {link}. Seriously man?")
elif kind == "grass":
author = post.author if post else comment.author
author.is_banned = AUTOJANNY_ACCOUNT
author.ban_reason = f"grass award used by @{v.username}"
g.db.add(self)
link = f"[this post]({post.permalink})" if post else f"[this comment]({comment.permalink})"
send_notification(NOTIFICATIONS_ACCOUNT, author, f"Your account has been suspended permanently for {link}. You must [provide the admins](/contact) a timestamped picture of you touching grass to get unbanned!")
post.author.received_award_count += 1
g.db.add(post.author)