remotes/1693045480750635534/spooky-22
Aevann1 2022-01-07 00:28:27 +02:00
parent 0e1dd2717b
commit b0d56b91ef
3 changed files with 51 additions and 1 deletions

View File

@ -295,7 +295,7 @@ BADGES = {
'description': 'Contributed at least $100' 'description': 'Contributed at least $100'
}, },
26: { 26: {
'name': 'Agendaposter', 'name': 'Rightoid Agendaposter',
'description': 'Forced to use the agendaposter theme' 'description': 'Forced to use the agendaposter theme'
}, },
27: { 27: {

View File

@ -277,6 +277,10 @@ def award_post(pid, v):
author.customtitle = filter_emojis_only(new_name) author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403) if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400 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": elif kind == "pause":
author.mute = True author.mute = True
if not author.has_badge(68): if not author.has_badge(68):
@ -292,16 +296,28 @@ def award_post(pid, v):
elif kind == "marsey": elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400 if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400 else: author.marseyawarded = int(time.time()) + 86400
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
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 == "pizzashill": elif kind == "pizzashill":
if author.bird: if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404 return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400 if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400 else: author.longpost = int(time.time()) + 86400
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
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 == "bird": elif kind == "bird":
if author.longpost: if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404 return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400 if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400 else: author.bird = int(time.time()) + 86400
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
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 == "eye": elif kind == "eye":
author.eye = True author.eye = True
if not author.has_badge(83): if not author.has_badge(83):
@ -330,6 +346,10 @@ def award_post(pid, v):
elif kind == "progressivestack": elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600 if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600 else: author.progressivestack = int(time.time()) + 21600
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
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 post.author.received_award_count: post.author.received_award_count += 1 if post.author.received_award_count: post.author.received_award_count += 1
else: post.author.received_award_count = 1 else: post.author.received_award_count = 1
@ -438,6 +458,10 @@ def award_comment(cid, v):
author.customtitle = filter_emojis_only(new_name) author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403) if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400 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": elif kind == "pause":
author.mute = True author.mute = True
if not author.has_badge(68): if not author.has_badge(68):
@ -453,16 +477,28 @@ def award_comment(cid, v):
elif kind == "marsey": elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400 if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400 else: author.marseyawarded = int(time.time()) + 86400
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
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 == "pizzashill": elif kind == "pizzashill":
if author.bird: if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404 return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400 if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400 else: author.longpost = int(time.time()) + 86400
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
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 == "bird": elif kind == "bird":
if author.longpost: if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404 return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400 if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400 else: author.bird = int(time.time()) + 86400
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
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 == "eye": elif kind == "eye":
author.eye = True author.eye = True
if not author.has_badge(83): if not author.has_badge(83):
@ -491,6 +527,10 @@ def award_comment(cid, v):
elif kind == "progressivestack": elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600 if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600 else: author.progressivestack = int(time.time()) + 21600
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
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 c.author.received_award_count: c.author.received_award_count += 1 if c.author.received_award_count: c.author.received_award_count += 1
else: c.author.received_award_count = 1 else: c.author.received_award_count = 1

View File

@ -171,30 +171,40 @@ def front_all(v):
v.flairchanged = None v.flairchanged = None
send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!") send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!")
g.db.add(v) g.db.add(v)
badge = v.has_badge(96)
if badge: g.db.delete(badge)
g.db.commit() g.db.commit()
if v.marseyawarded and v.marseyawarded < time.time(): if v.marseyawarded and v.marseyawarded < time.time():
v.marseyawarded = None v.marseyawarded = None
send_repeatable_notification(v.id, "Your marsey award has expired!") send_repeatable_notification(v.id, "Your marsey award has expired!")
g.db.add(v) g.db.add(v)
badge = v.has_badge(98)
if badge: g.db.delete(badge)
g.db.commit() g.db.commit()
if v.longpost and v.longpost < time.time(): if v.longpost and v.longpost < time.time():
v.longpost = None v.longpost = None
send_repeatable_notification(v.id, "Your pizzashill award has expired!") send_repeatable_notification(v.id, "Your pizzashill award has expired!")
g.db.add(v) g.db.add(v)
badge = v.has_badge(97)
if badge: g.db.delete(badge)
g.db.commit() g.db.commit()
if v.bird and v.bird < time.time(): if v.bird and v.bird < time.time():
v.bird = None v.bird = None
send_repeatable_notification(v.id, "Your bird site award has expired!") send_repeatable_notification(v.id, "Your bird site award has expired!")
g.db.add(v) g.db.add(v)
badge = v.has_badge(95)
if badge: g.db.delete(badge)
g.db.commit() g.db.commit()
if v.progressivestack and v.progressivestack < time.time(): if v.progressivestack and v.progressivestack < time.time():
v.progressivestack = None v.progressivestack = None
send_repeatable_notification(v.id, "Your progressive stack has expired!") send_repeatable_notification(v.id, "Your progressive stack has expired!")
g.db.add(v) g.db.add(v)
badge = v.has_badge(94)
if badge: g.db.delete(badge)
g.db.commit() g.db.commit()
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}