forked from rDrama/rDrama
1
0
Fork 0

dont send a push-notif if award fails

master
Aevann 2023-10-04 20:30:23 +03:00
parent 9852520cf1
commit 7ef3915bb1
1 changed files with 23 additions and 19 deletions

View File

@ -204,10 +204,6 @@ def award_thing(v, thing_type, id):
return {"message": f"{AWARDS[kind]['title']} award given to {thing_type} successfully!"}
if author.deflector and AWARDS[kind]['deflectable']:
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)
msg = f"{safe_username} 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
safe_username = f"Your award has been deflected but failed since you're"
@ -232,21 +228,6 @@ def award_thing(v, thing_type, id):
else:
link_text_in_notif = thing.title
msg = f"@{v.username} has given [{link_text_in_notif}]({thing.shortlink}) the {AWARDS[kind]['title']} Award"
if kind == 'shit':
msg += f" and has stolen from you {awarded_coins} coins as a result"
elif awarded_coins:
msg += f" and you have received {awarded_coins} coins as a result"
msg += "!"
if note:
note = '\n\n> '.join(note.splitlines())
if kind == "chud":
msg += f"\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**"
msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if kind == 'marsify' and author.marsify == 1:
abort(409, f"{safe_username} already permanently marsified!")
@ -617,6 +598,29 @@ def award_thing(v, thing_type, id):
author.jumpscare += 1
if v.id != author.id:
if author.deflector and AWARDS[kind]['deflectable']:
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)
msg = f"{safe_username} 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)
elif kind != 'spider':
msg = f"@{v.username} has given [{link_text_in_notif}]({thing.shortlink}) the {AWARDS[kind]['title']} Award"
if kind == 'shit':
msg += f" and has stolen from you {awarded_coins} coins as a result"
elif awarded_coins:
msg += f" and you have received {awarded_coins} coins as a result"
msg += "!"
if note:
note = '\n\n> '.join(note.splitlines())
if kind == "chud":
msg += f"\n\n**You now have to say this phrase in all posts and comments you make for 24 hours:**"
msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
g.db.add(author)