remotes/1693045480750635534/spooky-22
Aevann1 2022-01-25 01:49:02 +02:00
parent 2f48dc53e3
commit 0a06937147
4 changed files with 37 additions and 5 deletions

View File

@ -56,11 +56,7 @@ class Badge(Base):
@property
@lazy
def name(self):
try: return self.badge.name
except Exception as e:
print(e)
print(self.badge_id, flush=True)
return ""
return self.badge.name
@property
@lazy

View File

@ -78,6 +78,7 @@ def activate(v):
if not any(b.badge_id == 2 for b in user.badges):
mail_badge = Badge(user_id=user.id, badge_id=2)
g.db.add(mail_badge)
g.db.flush()
send_notification(user.id, f"@AutoJanny has given you the following profile badge:\n\n![]({mail_badge.path})\n\n{mail_badge.name}")

View File

@ -115,12 +115,14 @@ def buy(v, award):
if v.coins_spent >= 1000000 and not v.has_badge(73):
new_badge = Badge(badge_id=73, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
old_badge = v.has_badge(72)
if old_badge: g.db.delete(old_badge)
elif v.coins_spent >= 500000 and not v.has_badge(72):
new_badge = Badge(badge_id=72, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
old_badge = v.has_badge(71)
if old_badge: g.db.delete(old_badge)
@ -128,18 +130,21 @@ def buy(v, award):
new_badge = Badge(badge_id=71, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
old_badge = v.has_badge(70)
if old_badge: g.db.delete(old_badge)
elif v.coins_spent >= 100000 and not v.has_badge(70):
new_badge = Badge(badge_id=70, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
old_badge = v.has_badge(69)
if old_badge: g.db.delete(old_badge)
elif v.coins_spent >= 10000 and not v.has_badge(69):
new_badge = Badge(badge_id=69, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
g.db.add(v)
@ -157,14 +162,17 @@ def buy(v, award):
if v.lootboxes_bought == 10 and not v.has_badge(76):
new_badge = Badge(badge_id=76, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif v.lootboxes_bought == 50 and not v.has_badge(77):
new_badge = Badge(badge_id=77, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif v.lootboxes_bought == 150 and not v.has_badge(78):
new_badge = Badge(badge_id=78, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
else:
@ -280,6 +288,7 @@ def award_post(pid, v):
if not author.has_badge(26):
badge = Badge(user_id=author.id, badge_id=26)
g.db.add(badge)
g.db.flush()
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("𒐪","")
@ -293,18 +302,21 @@ def award_post(pid, v):
if not author.has_badge(96):
badge = Badge(user_id=author.id, badge_id=96)
g.db.add(badge)
g.db.flush()
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):
new_badge = Badge(badge_id=68, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unpausable":
author.unmutable = True
if not author.has_badge(67):
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
@ -312,6 +324,7 @@ def award_post(pid, v):
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pizzashill":
if author.bird:
@ -321,6 +334,7 @@ def award_post(pid, v):
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "bird":
if author.longpost:
@ -330,24 +344,28 @@ def award_post(pid, v):
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "eye":
author.eye = True
if not author.has_badge(83):
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "alt":
author.alt = True
if not author.has_badge(84):
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unblockable":
author.unblockable = True
if not author.has_badge(87):
new_badge = Badge(badge_id=87, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
@ -355,6 +373,7 @@ def award_post(pid, v):
if not author.has_badge(90):
new_badge = Badge(badge_id=90, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600
@ -362,6 +381,7 @@ def award_post(pid, v):
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
@ -369,6 +389,7 @@ def award_post(pid, v):
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
g.db.add(badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "ghosts":
post.ghost = True
@ -487,6 +508,7 @@ def award_comment(cid, v):
if not author.has_badge(26):
badge = Badge(user_id=author.id, badge_id=26)
g.db.add(badge)
g.db.flush()
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("𒐪","")
@ -500,18 +522,21 @@ def award_comment(cid, v):
if not author.has_badge(96):
badge = Badge(user_id=author.id, badge_id=96)
g.db.add(badge)
g.db.flush()
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):
new_badge = Badge(badge_id=68, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unpausable":
author.unmutable = True
if not author.has_badge(67):
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
@ -519,6 +544,7 @@ def award_comment(cid, v):
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pizzashill":
if author.bird:
@ -528,6 +554,7 @@ def award_comment(cid, v):
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "bird":
if author.longpost:
@ -537,24 +564,28 @@ def award_comment(cid, v):
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "eye":
author.eye = True
if not author.has_badge(83):
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "alt":
author.alt = True
if not author.has_badge(84):
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unblockable":
author.unblockable = True
if not author.has_badge(87):
new_badge = Badge(badge_id=87, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
@ -562,6 +593,7 @@ def award_comment(cid, v):
if not author.has_badge(90):
new_badge = Badge(badge_id=90, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600
@ -569,6 +601,7 @@ def award_comment(cid, v):
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
@ -576,6 +609,7 @@ def award_comment(cid, v):
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
g.db.add(badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "ghosts":
c.ghost = True

View File

@ -478,6 +478,7 @@ def gumroad(v):
if not v.has_badge(20+tier):
new_badge = Badge(badge_id=20+tier, user_id=v.id)
g.db.add(new_badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
g.db.commit()