forked from rDrama/rDrama
1
0
Fork 0
master
Aevann1 2021-12-11 05:32:43 +02:00
parent 8d1de6e628
commit 0fdaccdbbc
3 changed files with 5 additions and 2 deletions

View File

@ -96,6 +96,7 @@ class Submission(Base):
return False
def total_bet_voted(self, v):
if "closed" in self.body.lower(): return True
if v:
for option in self.bet_options:
if option.poll_voted(v): return True

View File

@ -182,7 +182,7 @@ else:
LONGPOSTBOT_ID = 4
ZOZBOT_ID = 5
AUTOPOLLER_ID = 6
AUTOBETTER_ID = 7
AUTOBETTER_ID = 10
TAX_RECEIVER_ID = 8
PIZZA_SHILL_ID = 0
IDIO_ID = 0

View File

@ -22,16 +22,18 @@ if SITE_NAME == 'PCM': cc = "splash mountain"
else: cc = "country club"
@app.get("/distribute/<cid>")
@admin_level_required(2)
@admin_level_required(3)
def distribute(v, cid):
try: int(cid)
except: abort(400)
post = g.db.query(Comment).filter_by(id=cid).first().post.permalink
votes = g.db.query(CommentVote).filter_by(comment_id=cid)
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).first()
coinsperperson = int(autobetter.coins / votes.count())
for vote in votes:
u = vote.user
u.coins += coinsperperson
send_notification(u.id, f"You won {coinsperperson} coins betting on https://{request.host}{post} !")
g.db.add(u)
autobetter.coins = 0