From 2c33b09bbcb281932ca72f9d6785573b67814662 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 16 Sep 2022 22:39:19 +0200 Subject: [PATCH] add vaporizing --- files/routes/awards.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/files/routes/awards.py b/files/routes/awards.py index 5c3e451cc..a5a8e5854 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -176,6 +176,20 @@ def award_thing(v, thing_type, id): return {"error": "User is already permenantly marsified!"}, 403 if v.id != author.id: + if author.deflector and v.deflector: + msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected on them, they also had a deflector up, so it bounced back and forth until it vaporized!" + send_repeatable_notification(author.id, msg) + + msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you but your deflector protected you, the award bounced back and forth until it vaporized!" + send_repeatable_notification(v.id, msg) + + g.db.delete(award) + + if request.referrer and len(request.referrer) > 1: + if request.referrer == f'{SITE_FULL}/submit': return redirect(thing.permalink) + elif request.referrer.startswith(f'{SITE_FULL}/'): return redirect(request.referrer) + return redirect(SITE_FULL) + if author.deflector and v.id != AEVANN_ID and (AWARDS[kind]['price'] > 500 or kind == 'marsify' or kind.istitle()) and kind not in ('pin','unpin','benefactor'): msg = f"@{v.username} has tried to give your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:" send_repeatable_notification(author.id, msg)