From d0528c0431e6dedd576a80257e022e9029aa29c4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 11 Jan 2022 02:11:34 +0200 Subject: [PATCH] bbb --- files/routes/awards.py | 38 ++++++++++++++++++++++---------------- requirements.txt | 1 + 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/files/routes/awards.py b/files/routes/awards.py index e0449a4eb..ade38963b 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -272,14 +272,17 @@ def award_post(pid, v): send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") elif kind == "flairlock": new_name = note[:100].replace("𒐪","") - author.customtitleplain = new_name - author.customtitle = filter_emojis_only(new_name) - if len(author.customtitle) > 1000: abort(403) - author.flairchanged = int(time.time()) + 86400 - if not author.has_badge(96): - badge = Badge(user_id=author.id, badge_id=96) - g.db.add(badge) - send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") + if not new_name and author.flairchanged: + author.flairchanged += 86400 + else: + author.customtitleplain = new_name + author.customtitle = filter_emojis_only(new_name) + if len(author.customtitle) > 1000: abort(403) + author.flairchanged = int(time.time()) + 86400 + if not author.has_badge(96): + badge = Badge(user_id=author.id, badge_id=96) + g.db.add(badge) + send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") elif kind == "pause": author.mute = True if not author.has_badge(68): @@ -453,14 +456,17 @@ def award_comment(cid, v): send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") elif kind == "flairlock": new_name = note[:100].replace("𒐪","") - author.customtitleplain = new_name - author.customtitle = filter_emojis_only(new_name) - if len(author.customtitle) > 1000: abort(403) - author.flairchanged = int(time.time()) + 86400 - if not author.has_badge(96): - badge = Badge(user_id=author.id, badge_id=96) - g.db.add(badge) - send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") + if not new_name and author.flairchanged: + author.flairchanged += 86400 + else: + author.customtitleplain = new_name + author.customtitle = filter_emojis_only(new_name) + if len(author.customtitle) > 1000: abort(403) + author.flairchanged = int(time.time()) + 86400 + if not author.has_badge(96): + badge = Badge(user_id=author.id, badge_id=96) + g.db.add(badge) + send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}") elif kind == "pause": author.mute = True if not author.has_badge(68): diff --git a/requirements.txt b/requirements.txt index eed0a0b02..0b6cb11cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,6 +14,7 @@ matplotlib mistletoe piexif Pillow +psutil pyotp qrcode redis