fgfg\
This commit is contained in:
parent
d7c7db6619
commit
2dd022e632
1 changed files with 3 additions and 1 deletions
|
@ -58,6 +58,9 @@ def remove_admin(v, username):
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def distribute(v, comment):
|
def distribute(v, comment):
|
||||||
|
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).one_or_none()
|
||||||
|
if autobetter.coins == 0: return {"error": "@AutoBetter has 0 coins"}
|
||||||
|
|
||||||
try: comment = int(comment)
|
try: comment = int(comment)
|
||||||
except: abort(400)
|
except: abort(400)
|
||||||
post = g.db.query(Comment.parent_submission).filter_by(id=comment).one_or_none()[0]
|
post = g.db.query(Comment.parent_submission).filter_by(id=comment).one_or_none()[0]
|
||||||
|
@ -67,7 +70,6 @@ def distribute(v, comment):
|
||||||
for option in post.bet_options: pool += option.upvotes
|
for option in post.bet_options: pool += option.upvotes
|
||||||
pool *= 200
|
pool *= 200
|
||||||
|
|
||||||
autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).one_or_none()
|
|
||||||
autobetter.coins -= pool
|
autobetter.coins -= pool
|
||||||
if autobetter.coins < 0: autobetter.coins = 0
|
if autobetter.coins < 0: autobetter.coins = 0
|
||||||
g.db.add(autobetter)
|
g.db.add(autobetter)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue