forked from rDrama/rDrama
award badges shit
parent
5298707157
commit
9475aa27e4
Binary file not shown.
Before Width: | Height: | Size: 337 KiB After Width: | Height: | Size: 4.2 KiB |
|
@ -52,6 +52,12 @@ class Badge(Base):
|
|||
if self.badge_id == 97: return self.user.longpost
|
||||
if self.badge_id == 98: return self.user.marseyawarded
|
||||
if self.badge_id == 109: return self.user.rehab
|
||||
if self.badge_id == 167: return self.user.owoify
|
||||
if self.badge_id == 168: return self.user.bite
|
||||
if self.badge_id == 169: return self.user.earlylife
|
||||
if self.badge_id == 170: return self.user.marsify
|
||||
if self.badge_id == 171: return self.user.rainbow
|
||||
|
||||
return None
|
||||
|
||||
@property
|
||||
|
|
|
@ -8,96 +8,90 @@ from files.classes.user import User
|
|||
|
||||
def award_timers(v, bot=False):
|
||||
now = time.time()
|
||||
dirty = False
|
||||
|
||||
def notify_if_not_bot(msg):
|
||||
if not bot:
|
||||
send_repeatable_notification(v.id,msg)
|
||||
send_repeatable_notification(v.id, msg)
|
||||
|
||||
if v.patron_utc and v.patron_utc < now:
|
||||
v.patron = 0
|
||||
v.patron_utc = 0
|
||||
notify_if_not_bot(f"Your {patron} status has expired!")
|
||||
if not bot and v.discord_id: remove_role(v, "1")
|
||||
dirty = True
|
||||
if v.unban_utc and v.unban_utc < now:
|
||||
v.is_banned = 0
|
||||
v.unban_utc = 0
|
||||
v.ban_evade = 0
|
||||
v.ban_reason = None
|
||||
notify_if_not_bot("You have been unbanned!")
|
||||
dirty = True
|
||||
if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now:
|
||||
v.agendaposter = 0
|
||||
notify_if_not_bot("Your chud theme has expired!")
|
||||
badge = v.has_badge(28)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.flairchanged and v.flairchanged < now:
|
||||
v.flairchanged = None
|
||||
notify_if_not_bot("Your flair lock has expired. You can now change your flair!")
|
||||
badge = v.has_badge(96)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.marseyawarded and v.marseyawarded < now:
|
||||
v.marseyawarded = None
|
||||
notify_if_not_bot("Your marsey award has expired!")
|
||||
badge = v.has_badge(98)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.longpost and v.longpost < now:
|
||||
v.longpost = None
|
||||
notify_if_not_bot("Your pizzashill award has expired!")
|
||||
badge = v.has_badge(97)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.bird and v.bird < now:
|
||||
v.bird = None
|
||||
notify_if_not_bot("Your bird site award has expired!")
|
||||
badge = v.has_badge(95)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.progressivestack and v.progressivestack < now:
|
||||
v.progressivestack = None
|
||||
notify_if_not_bot("Your progressive stack has expired!")
|
||||
badge = v.has_badge(94)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.rehab and v.rehab < now:
|
||||
v.rehab = None
|
||||
notify_if_not_bot("Your rehab has finished!")
|
||||
badge = v.has_badge(109)
|
||||
if badge: g.db.delete(badge)
|
||||
dirty = True
|
||||
if v.deflector and v.deflector < now:
|
||||
v.deflector = None
|
||||
notify_if_not_bot("Your deflector has expired!")
|
||||
dirty = True
|
||||
if v.rainbow and v.rainbow < now:
|
||||
v.rainbow = None
|
||||
notify_if_not_bot("Your rainbow has expired!")
|
||||
dirty = True
|
||||
if v.owoify and v.owoify < now:
|
||||
v.owoify = None
|
||||
notify_if_not_bot("Your OwOify status has expired!")
|
||||
v.house = v.old_house
|
||||
badge = v.has_badge(167)
|
||||
if v.bite and v.bite < now:
|
||||
v.bite = None
|
||||
notify_if_not_bot("Your vampire status has ended!")
|
||||
v.house = v.old_house
|
||||
dirty = True
|
||||
badge = v.has_badge(168)
|
||||
if badge: g.db.delete(badge)
|
||||
if v.earlylife and v.earlylife < now:
|
||||
v.earlylife = None
|
||||
notify_if_not_bot("Your earlylife status has expired!")
|
||||
dirty = True
|
||||
if v.owoify and v.owoify < now:
|
||||
v.owoify = None
|
||||
notify_if_not_bot("Your owoify status has expired!")
|
||||
dirty = True
|
||||
v.house = v.old_house
|
||||
badge = v.has_badge(169)
|
||||
if v.marsify and v.marsify != 1 and v.marsify < now:
|
||||
v.marsify = 0
|
||||
if SITE_NAME != 'rDrama': notify_if_not_bot("Your marsify status has expired!")
|
||||
dirty = True
|
||||
badge = v.has_badge(170)
|
||||
if badge: g.db.delete(badge)
|
||||
if v.rainbow and v.rainbow < now:
|
||||
v.rainbow = None
|
||||
notify_if_not_bot("Your rainbow has expired!")
|
||||
v.house = v.old_house
|
||||
badge = v.has_badge(171)
|
||||
|
||||
if dirty:
|
||||
g.db.add(v)
|
||||
|
||||
|
||||
def award_timers_bots_task():
|
||||
accs = g.db.query(User).filter(User.id.in_(bots))
|
||||
for u in accs:
|
||||
|
|
|
@ -347,6 +347,7 @@ def award_thing(v, thing_type, id):
|
|||
elif kind == 'marsify':
|
||||
if author.marsify: author.marsify += 21600
|
||||
else: author.marsify = int(time.time()) + 21600
|
||||
badge_grant(user=author, badge_id=170)
|
||||
|
||||
if thing_type == 'comment' and (not author.deflector or v.id == AEVANN_ID):
|
||||
body = thing.body
|
||||
|
@ -359,12 +360,15 @@ def award_thing(v, thing_type, id):
|
|||
else: author.bite = int(time.time()) + 86400 * 7
|
||||
author.old_house = author.house
|
||||
author.house = 'Vampire'
|
||||
badge_grant(user=author, badge_id=168)
|
||||
elif "Racist" in kind and kind == v.house:
|
||||
if author.earlylife: author.earlylife += 86400
|
||||
else: author.earlylife = int(time.time()) + 86400
|
||||
badge_grant(user=author, badge_id=169)
|
||||
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
|
||||
if author.owoify: author.owoify += 21600
|
||||
else: author.owoify = int(time.time()) + 21600
|
||||
badge_grant(user=author, badge_id=167)
|
||||
|
||||
if thing_type == 'comment' and not (author.deflector or v.id == AEVANN_ID):
|
||||
body = thing.body
|
||||
|
@ -375,6 +379,7 @@ def award_thing(v, thing_type, id):
|
|||
elif ("Femboy" in kind and kind == v.house):
|
||||
if author.rainbow: author.rainbow += 86400
|
||||
else: author.rainbow = int(time.time()) + 86400
|
||||
badge_grant(user=author, badge_id=171)
|
||||
|
||||
if author.received_award_count: author.received_award_count += 1
|
||||
else: author.received_award_count = 1
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<label for="badge-{{badge.id}}">
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?v=1" width=64.16 height=70>
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?b=1" width=64.16 height=70>
|
||||
</label>
|
||||
</td>
|
||||
<td>{{badge.name}}</td>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<label for="badge-{{badge.id}}">
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?v=1" width=64.16 height=70>
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?b=1" width=64.16 height=70>
|
||||
</label>
|
||||
</td>
|
||||
<td>{{badge.name}}</td>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<td>{{loop.index}}</td>
|
||||
<td>{{badge.name}}</td>
|
||||
<td>
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?v=1" width=45.83 height=50>
|
||||
<img class="contain" alt="{{badge.name}}" loading="lazy" src="{{badge.path}}?b=1" width=45.83 height=50>
|
||||
</td>
|
||||
<td>{{badge.description}}</td>
|
||||
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
|
||||
|
|
|
@ -375,10 +375,10 @@
|
|||
{% for b in u.badges %}
|
||||
{% if b.url %}
|
||||
<a class="contain" rel="nofollow noopener noreferrer" href="{{b.url}}">
|
||||
<img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
<img alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}?b=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
</a>
|
||||
{% else %}
|
||||
<img class="contain" alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
<img class="contain" alt="{{b.name}}" width=55 height=60 loading="lazy" src="{{b.path}}?b=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -529,10 +529,10 @@
|
|||
{% for b in u.badges %}
|
||||
{% if b.url %}
|
||||
<a rel="nofollow noopener noreferrer" href="{{b.url}}">
|
||||
<img class="contain" alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
<img class="contain" alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}?b=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
</a>
|
||||
{% else %}
|
||||
<img class="contain" alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}?v=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
<img class="contain" alt="{{b.name}}" width=29.33 height=32 loading="lazy" src="{{b.path}}?b=1" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{b.text}}" {% if b.until %}data-until="{{b.until}}" onmouseover="badge_timestamp(this)"{% endif %}>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue