change "king" award to "gold" award

master
Aevann 2023-10-06 20:39:27 +03:00
parent 74e9812e4d
commit 6c403fcb18
10 changed files with 21 additions and 30 deletions

View File

@ -69,7 +69,6 @@ class Badge(Base):
if self.badge_id == 281: return self.user.namechanged if self.badge_id == 281: return self.user.namechanged
if self.badge_id == 285: return self.user.queen if self.badge_id == 285: return self.user.queen
if self.badge_id == 289: return self.user.sharpen if self.badge_id == 289: return self.user.sharpen
if self.badge_id == 302: return self.user.king
return None return None

View File

@ -26,10 +26,10 @@ def get_award_classes(obj, v, title=False):
if not (v and v.poor): if not (v and v.poor):
if obj.award_count('glowie', v): if obj.award_count('glowie', v):
classes.append("glow") classes.append("glow")
if obj.award_count('gold', v):
classes.append("gold-text")
if obj.rainbowed: if obj.rainbowed:
classes.append("rainbow-text") classes.append("rainbow-text")
# if obj.golden:
# classes.append("gold-text")
if obj.queened: if obj.queened:
classes.append("queen") classes.append("queen")
if obj.sharpened: if obj.sharpened:
@ -197,7 +197,6 @@ class Comment(Base):
casino_game_id = Column(Integer, ForeignKey("casino_games.id")) casino_game_id = Column(Integer, ForeignKey("casino_games.id"))
chudded = Column(Boolean, default=False) chudded = Column(Boolean, default=False)
rainbowed = Column(Boolean, default=False) rainbowed = Column(Boolean, default=False)
golden = Column(Boolean, default=False)
queened = Column(Boolean, default=False) queened = Column(Boolean, default=False)
sharpened = Column(Boolean, default=False) sharpened = Column(Boolean, default=False)

View File

@ -63,7 +63,6 @@ class Post(Base):
notify = Column(Boolean) notify = Column(Boolean)
chudded = Column(Boolean, default=False) chudded = Column(Boolean, default=False)
rainbowed = Column(Boolean, default=False) rainbowed = Column(Boolean, default=False)
golden = Column(Boolean, default=False)
queened = Column(Boolean, default=False) queened = Column(Boolean, default=False)
sharpened = Column(Boolean, default=False) sharpened = Column(Boolean, default=False)
ping_cost = Column(Integer, default=0) ping_cost = Column(Integer, default=0)

View File

@ -90,7 +90,6 @@ class User(Base):
lootboxes_bought = Column(Integer, default=0) lootboxes_bought = Column(Integer, default=0)
chud = Column(Integer, default=0) chud = Column(Integer, default=0)
queen = Column(Integer, default=0) queen = Column(Integer, default=0)
king = Column(Integer, default=0)
chud_phrase = Column(String) chud_phrase = Column(String)
email_verified = Column(Boolean, default=False) email_verified = Column(Boolean, default=False)
shadowbanned = Column(Integer, ForeignKey("users.id")) shadowbanned = Column(Integer, ForeignKey("users.id"))

View File

@ -541,6 +541,19 @@ AWARDS = {
"enabled": True, "enabled": True,
"positive": False, "positive": False,
}, },
"gold": {
"kind": "gold",
"title": "Gold",
"description": "Gold is a virtual good you can use on Reddit to reward, recognize, and celebrate content from redditors you love. If you like a post or comment and want to show your appreciation for it, you can give it gold. This will help the post or comment stand out on Reddit.",
"icon": "fas fa-coin",
"color": "text-gold",
"price": 500,
"deflectable": False,
"cosmetic": True,
"ghost": True,
"enabled": True,
"positive": True,
},
"spider": { "spider": {
"kind": "spider", "kind": "spider",
"title": "Spider!", "title": "Spider!",
@ -606,19 +619,6 @@ AWARDS = {
"enabled": True, "enabled": True,
"positive": False, "positive": False,
}, },
"king": {
"kind": "king",
"title": "King",
"description": "Gives the recipient golden text for 24 hours.",
"icon": "fas fa-crown",
"color": "text-gold",
"price": 1000,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
"positive": True,
},
"queen": { "queen": {
"kind": "queen", "kind": "queen",
"title": "Queen", "title": "Queen",

View File

@ -174,7 +174,6 @@ def _create_post(title, body, pin_hours):
ghost=False, ghost=False,
chudded=False, chudded=False,
rainbowed=False, rainbowed=False,
golden=False,
queened=False, queened=False,
sharpened=False, sharpened=False,
stickied_utc=stickied_utc, stickied_utc=stickied_utc,
@ -405,7 +404,6 @@ def _award_timers_task():
_process_timer(User.marsify, [170], "The marsify award you received has expired!") _process_timer(User.marsify, [170], "The marsify award you received has expired!")
_process_timer(User.rainbow, [171], "The rainbow award you received has expired!") _process_timer(User.rainbow, [171], "The rainbow award you received has expired!")
_process_timer(User.queen, [285], "The queen award you received has expired!") _process_timer(User.queen, [285], "The queen award you received has expired!")
_process_timer(User.king, [302], "The king award you received has expired!")
_process_timer(User.spider, [179], "The spider award you received has expired!") _process_timer(User.spider, [179], "The spider award you received has expired!")
_process_timer(User.namechanged, [281], "The namelock award you received has expired. You're now back to your old username!", { _process_timer(User.namechanged, [281], "The namelock award you received has expired. You're now back to your old username!", {
User.username: User.prelock_username, User.username: User.prelock_username,

View File

@ -540,13 +540,6 @@ def award_thing(v, thing_type, id):
if thing_type == 'comment' and (not thing.author.deflector or v == thing.author): if thing_type == 'comment' and (not thing.author.deflector or v == thing.author):
thing.rainbowed = True thing.rainbowed = True
g.db.add(thing) g.db.add(thing)
elif kind == 'king':
if author.king: author.king += 86400
else: author.king = int(time.time()) + 86400
badge_grant(user=author, badge_id=302)
if thing_type == 'comment' and (not thing.author.deflector or v == thing.author):
thing.golden = True
g.db.add(thing)
elif kind == "emoji": elif kind == "emoji":
award.note = award.note.strip(":").lower() award.note = award.note.strip(":").lower()
emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none() emoji = g.db.query(Emoji).filter_by(name=award.note).one_or_none()

View File

@ -277,7 +277,6 @@ def comment(v):
ghost=ghost, ghost=ghost,
chudded=chudded, chudded=chudded,
rainbowed=bool(v.rainbow), rainbowed=bool(v.rainbow),
golden=bool(v.king),
queened=bool(v.queen), queened=bool(v.queen),
sharpened=bool(v.sharpen), sharpened=bool(v.sharpen),
) )

View File

@ -571,7 +571,6 @@ def submit_post(v, sub=None):
ghost=flag_ghost, ghost=flag_ghost,
chudded=flag_chudded, chudded=flag_chudded,
rainbowed=bool(v.rainbow), rainbowed=bool(v.rainbow),
golden=bool(v.king),
queened=bool(v.queen), queened=bool(v.queen),
sharpened=bool(v.sharpen), sharpened=bool(v.sharpen),
) )

View File

@ -0,0 +1,6 @@
delete from badges where badge_id=302;
delete from badge_defs where id=302;
alter table users drop column king;
alter table posts drop column golden;
alter table comments drop column golden;