made spider award not give any notifs

master
Aevann1 2022-09-21 22:27:12 +02:00
parent a5b615190d
commit 61739b765e
2 changed files with 7 additions and 6 deletions

View File

@ -8,7 +8,7 @@ from files.helpers.slots import *
import random import random
from urllib.parse import quote 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 assert user != None
if user.has_badge(badge_id): if user.has_badge(badge_id):
return return
@ -23,6 +23,7 @@ def badge_grant(user, badge_id, description=None, url=None):
g.db.add(badge) g.db.add(badge)
g.db.flush() g.db.flush()
if notify:
send_repeatable_notification(user.id, send_repeatable_notification(user.id,
f"@AutoJanny has given you the following profile badge:\n\n" + f"@AutoJanny has given you the following profile badge:\n\n" +
f"![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}") f"![]({badge.path})\n\n**{badge.name}**\n\n{badge.badge.description}")

View File

@ -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:" 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) send_repeatable_notification(v.id, msg)
author = v author = v
else: elif kind != 'spider':
msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!" msg = f"@{v.username} has given your [{thing_type}]({thing.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}" if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg) 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 return {"error": "Carp is immune to the spider award!"}, 403
if author.spider: author.spider += 86400 if author.spider: author.spider += 86400
else: author.spider = int(time.time()) + 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 if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1 else: author.received_award_count = 1