made spider award not give any notifs

remotes/1693176582716663532/tmp_refs/heads/watchparty
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
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):

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:"
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