remotes/1693045480750635534/spooky-22
Aevann1 2022-01-29 04:48:34 +02:00
parent 9a27676b21
commit 951f873a91
4 changed files with 11 additions and 1 deletions

View File

@ -46,6 +46,7 @@ class User(Base):
profileurl = Column(String)
bannerurl = Column(String)
patron = Column(Integer, default=0)
patron_utc = Column(Integer, default=0)
verified = Column(String)
verifiedcolor = Column(String)
marseyawarded = Column(Integer)

View File

@ -211,7 +211,7 @@ def monthly(v):
emails = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
for u in g.db.query(User).filter(User.patron > 0).all():
for u in g.db.query(User).filter(User.patron > 0, User.patron_utc == 0).all():
if u.email and u.email.lower() in emails:
if u.patron == 1: procoins = 2500
elif u.patron == 2: procoins = 5000

View File

@ -390,6 +390,7 @@ def award_post(pid, v):
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
author.patron_utc += int(time.time()) + 2629746
author.procoins += 2500
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)
@ -611,6 +612,7 @@ def award_comment(cid, v):
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
author.patron_utc += int(time.time()) + 2629746
author.procoins += 2500
if not v.has_badge(103):
badge = Badge(user_id=v.id, badge_id=103)

View File

@ -168,6 +168,13 @@ def front_all(v):
posts = get_posts(ids, v=v)
if v:
if v.patron_utc and v.patron_utc < time.time():
v.patron = 0
v.patron_utc = 0
send_repeatable_notification(v.id, "Your paypig status has expired!")
g.db.add(v)
g.db.commit()
if v.unban_utc and v.unban_utc < time.time():
v.is_banned = 0
v.unban_utc = 0