Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. @bot.on.message('клик', lower=True)
  2. async def wrapper(ans: Message):
  3. if ans.from_id < 0:
  4. pass
  5. else:
  6. q.execute(f"SELECT * FROM bots WHERE userid = {ans.from_id}")
  7. result = q.fetchall()
  8. win = random.randint(1,3)
  9. q.execute("UPDATE bots SET balance = '%s' WHERE userid = '%s'" % (result[0][1] + win))
  10. balance = result[0][1]
  11. connection.commit()
  12. await ans(f'{balance}')
  13. if len(result) == 0:
  14. user = await bot.api.users.get(user_ids=ans.from_id)
  15. name = user[0]['first_name']
  16. q.execute('INSERT INTO bots (balance, userid, nickname) VALUES ("%s", "%s", "%s")' % (0, ans.from_id, name))
  17. await ans('zaregal')
  18. connection.commit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement