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 == 97: return self.user.longpost
|
||||||
if self.badge_id == 98: return self.user.marseyawarded
|
if self.badge_id == 98: return self.user.marseyawarded
|
||||||
if self.badge_id == 109: return self.user.rehab
|
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
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -8,95 +8,89 @@ from files.classes.user import User
|
||||||
|
|
||||||
def award_timers(v, bot=False):
|
def award_timers(v, bot=False):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
dirty = False
|
|
||||||
|
|
||||||
def notify_if_not_bot(msg):
|
def notify_if_not_bot(msg):
|
||||||
if not bot:
|
if not bot:
|
||||||
send_repeatable_notification(v.id,msg)
|
send_repeatable_notification(v.id, msg)
|
||||||
|
|
||||||
if v.patron_utc and v.patron_utc < now:
|
if v.patron_utc and v.patron_utc < now:
|
||||||
v.patron = 0
|
v.patron = 0
|
||||||
v.patron_utc = 0
|
v.patron_utc = 0
|
||||||
notify_if_not_bot(f"Your {patron} status has expired!")
|
notify_if_not_bot(f"Your {patron} status has expired!")
|
||||||
if not bot and v.discord_id: remove_role(v, "1")
|
if not bot and v.discord_id: remove_role(v, "1")
|
||||||
dirty = True
|
|
||||||
if v.unban_utc and v.unban_utc < now:
|
if v.unban_utc and v.unban_utc < now:
|
||||||
v.is_banned = 0
|
v.is_banned = 0
|
||||||
v.unban_utc = 0
|
v.unban_utc = 0
|
||||||
v.ban_evade = 0
|
v.ban_evade = 0
|
||||||
v.ban_reason = None
|
v.ban_reason = None
|
||||||
notify_if_not_bot("You have been unbanned!")
|
notify_if_not_bot("You have been unbanned!")
|
||||||
dirty = True
|
|
||||||
if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now:
|
if v.agendaposter and v.agendaposter != 1 and v.agendaposter < now:
|
||||||
v.agendaposter = 0
|
v.agendaposter = 0
|
||||||
notify_if_not_bot("Your chud theme has expired!")
|
notify_if_not_bot("Your chud theme has expired!")
|
||||||
badge = v.has_badge(28)
|
badge = v.has_badge(28)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.flairchanged and v.flairchanged < now:
|
if v.flairchanged and v.flairchanged < now:
|
||||||
v.flairchanged = None
|
v.flairchanged = None
|
||||||
notify_if_not_bot("Your flair lock has expired. You can now change your flair!")
|
notify_if_not_bot("Your flair lock has expired. You can now change your flair!")
|
||||||
badge = v.has_badge(96)
|
badge = v.has_badge(96)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.marseyawarded and v.marseyawarded < now:
|
if v.marseyawarded and v.marseyawarded < now:
|
||||||
v.marseyawarded = None
|
v.marseyawarded = None
|
||||||
notify_if_not_bot("Your marsey award has expired!")
|
notify_if_not_bot("Your marsey award has expired!")
|
||||||
badge = v.has_badge(98)
|
badge = v.has_badge(98)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.longpost and v.longpost < now:
|
if v.longpost and v.longpost < now:
|
||||||
v.longpost = None
|
v.longpost = None
|
||||||
notify_if_not_bot("Your pizzashill award has expired!")
|
notify_if_not_bot("Your pizzashill award has expired!")
|
||||||
badge = v.has_badge(97)
|
badge = v.has_badge(97)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.bird and v.bird < now:
|
if v.bird and v.bird < now:
|
||||||
v.bird = None
|
v.bird = None
|
||||||
notify_if_not_bot("Your bird site award has expired!")
|
notify_if_not_bot("Your bird site award has expired!")
|
||||||
badge = v.has_badge(95)
|
badge = v.has_badge(95)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.progressivestack and v.progressivestack < now:
|
if v.progressivestack and v.progressivestack < now:
|
||||||
v.progressivestack = None
|
v.progressivestack = None
|
||||||
notify_if_not_bot("Your progressive stack has expired!")
|
notify_if_not_bot("Your progressive stack has expired!")
|
||||||
badge = v.has_badge(94)
|
badge = v.has_badge(94)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.rehab and v.rehab < now:
|
if v.rehab and v.rehab < now:
|
||||||
v.rehab = None
|
v.rehab = None
|
||||||
notify_if_not_bot("Your rehab has finished!")
|
notify_if_not_bot("Your rehab has finished!")
|
||||||
badge = v.has_badge(109)
|
badge = v.has_badge(109)
|
||||||
if badge: g.db.delete(badge)
|
if badge: g.db.delete(badge)
|
||||||
dirty = True
|
|
||||||
if v.deflector and v.deflector < now:
|
if v.deflector and v.deflector < now:
|
||||||
v.deflector = None
|
v.deflector = None
|
||||||
notify_if_not_bot("Your deflector has expired!")
|
notify_if_not_bot("Your deflector has expired!")
|
||||||
dirty = True
|
if v.owoify and v.owoify < now:
|
||||||
if v.rainbow and v.rainbow < now:
|
v.owoify = None
|
||||||
v.rainbow = None
|
notify_if_not_bot("Your OwOify status has expired!")
|
||||||
notify_if_not_bot("Your rainbow has expired!")
|
v.house = v.old_house
|
||||||
dirty = True
|
badge = v.has_badge(167)
|
||||||
if v.bite and v.bite < now:
|
if v.bite and v.bite < now:
|
||||||
v.bite = None
|
v.bite = None
|
||||||
notify_if_not_bot("Your vampire status has ended!")
|
notify_if_not_bot("Your vampire status has ended!")
|
||||||
v.house = v.old_house
|
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:
|
if v.earlylife and v.earlylife < now:
|
||||||
v.earlylife = None
|
v.earlylife = None
|
||||||
notify_if_not_bot("Your earlylife status has expired!")
|
notify_if_not_bot("Your earlylife status has expired!")
|
||||||
dirty = True
|
v.house = v.old_house
|
||||||
if v.owoify and v.owoify < now:
|
badge = v.has_badge(169)
|
||||||
v.owoify = None
|
|
||||||
notify_if_not_bot("Your owoify status has expired!")
|
|
||||||
dirty = True
|
|
||||||
if v.marsify and v.marsify != 1 and v.marsify < now:
|
if v.marsify and v.marsify != 1 and v.marsify < now:
|
||||||
v.marsify = 0
|
v.marsify = 0
|
||||||
if SITE_NAME != 'rDrama': notify_if_not_bot("Your marsify status has expired!")
|
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)
|
||||||
|
|
||||||
|
g.db.add(v)
|
||||||
|
|
||||||
if dirty:
|
|
||||||
g.db.add(v)
|
|
||||||
|
|
||||||
def award_timers_bots_task():
|
def award_timers_bots_task():
|
||||||
accs = g.db.query(User).filter(User.id.in_(bots))
|
accs = g.db.query(User).filter(User.id.in_(bots))
|
||||||
|
|
|
@ -347,6 +347,7 @@ def award_thing(v, thing_type, id):
|
||||||
elif kind == 'marsify':
|
elif kind == 'marsify':
|
||||||
if author.marsify: author.marsify += 21600
|
if author.marsify: author.marsify += 21600
|
||||||
else: author.marsify = int(time.time()) + 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):
|
if thing_type == 'comment' and (not author.deflector or v.id == AEVANN_ID):
|
||||||
body = thing.body
|
body = thing.body
|
||||||
|
@ -359,12 +360,15 @@ def award_thing(v, thing_type, id):
|
||||||
else: author.bite = int(time.time()) + 86400 * 7
|
else: author.bite = int(time.time()) + 86400 * 7
|
||||||
author.old_house = author.house
|
author.old_house = author.house
|
||||||
author.house = 'Vampire'
|
author.house = 'Vampire'
|
||||||
|
badge_grant(user=author, badge_id=168)
|
||||||
elif "Racist" in kind and kind == v.house:
|
elif "Racist" in kind and kind == v.house:
|
||||||
if author.earlylife: author.earlylife += 86400
|
if author.earlylife: author.earlylife += 86400
|
||||||
else: author.earlylife = int(time.time()) + 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':
|
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
|
||||||
if author.owoify: author.owoify += 21600
|
if author.owoify: author.owoify += 21600
|
||||||
else: author.owoify = int(time.time()) + 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):
|
if thing_type == 'comment' and not (author.deflector or v.id == AEVANN_ID):
|
||||||
body = thing.body
|
body = thing.body
|
||||||
|
@ -375,6 +379,7 @@ def award_thing(v, thing_type, id):
|
||||||
elif ("Femboy" in kind and kind == v.house):
|
elif ("Femboy" in kind and kind == v.house):
|
||||||
if author.rainbow: author.rainbow += 86400
|
if author.rainbow: author.rainbow += 86400
|
||||||
else: author.rainbow = int(time.time()) + 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
|
if author.received_award_count: author.received_award_count += 1
|
||||||
else: author.received_award_count = 1
|
else: author.received_award_count = 1
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<label for="badge-{{badge.id}}">
|
<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>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<label for="badge-{{badge.id}}">
|
<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>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<td>{{loop.index}}</td>
|
<td>{{loop.index}}</td>
|
||||||
<td>{{badge.name}}</td>
|
<td>{{badge.name}}</td>
|
||||||
<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>
|
||||||
<td>{{badge.description}}</td>
|
<td>{{badge.description}}</td>
|
||||||
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
|
{%- set ct = counts[badge.id] if badge.id in counts else (0, 0) %}
|
||||||
|
|
|
@ -375,10 +375,10 @@
|
||||||
{% for b in u.badges %}
|
{% for b in u.badges %}
|
||||||
{% if b.url %}
|
{% if b.url %}
|
||||||
<a class="contain" rel="nofollow noopener noreferrer" href="{{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>
|
</a>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -529,10 +529,10 @@
|
||||||
{% for b in u.badges %}
|
{% for b in u.badges %}
|
||||||
{% if b.url %}
|
{% if b.url %}
|
||||||
<a rel="nofollow noopener noreferrer" href="{{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>
|
</a>
|
||||||
{% else %}
|
{% 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 %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue