From 61739b765e0cf738d5740e000dff8280afd01e26 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 21 Sep 2022 22:27:12 +0200 Subject: [PATCH] made spider award not give any notifs --- files/helpers/actions.py | 9 +++++---- files/routes/awards.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/files/helpers/actions.py b/files/helpers/actions.py index ed36541ab..bd7636408 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -8,7 +8,7 @@ from files.helpers.slots import * import random from urllib.parse import quote -def badge_grant(user, badge_id, description=None, url=None): +def badge_grant(user, badge_id, description=None, url=None, notify=True): assert user != None if user.has_badge(badge_id): return @@ -23,9 +23,10 @@ def badge_grant(user, badge_id, description=None, url=None): g.db.add(badge) g.db.flush() - send_repeatable_notification(user.id, - f"@AutoJanny has given you the following profile badge:\n\n" + - f"![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}") + if notify: + send_repeatable_notification(user.id, + f"@AutoJanny has given you the following profile badge:\n\n" + + f"![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}") def archiveorg(url): diff --git a/files/routes/awards.py b/files/routes/awards.py index 2fb34ecf8..17676ab46 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -196,7 +196,7 @@ def award_thing(v, thing_type, id): msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:" send_repeatable_notification(v.id, msg) author = v - else: + elif kind != 'spider': msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!" if note: msg += f"\n\n> {note}" send_repeatable_notification(author.id, msg) @@ -410,7 +410,7 @@ def award_thing(v, thing_type, id): return {"error": "Carp is immune to the spider award!"}, 403 if author.spider: author.spider += 86400 else: author.spider = int(time.time()) + 86400 - badge_grant(user=author, badge_id=179) + badge_grant(user=author, badge_id=179, notify=False) if author.received_award_count: author.received_award_count += 1 else: author.received_award_count = 1