Python Telegram Minesweeper Bot https://github.com/isjerryxiao/tgmsbot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
865 B

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. db = lambda _=None: None
  4. setattr(db, 'close', lambda _=None: None)
  5. pool = dict()
  6. class Player():
  7. def __init__(self, user_id, mines, death, wins,
  8. restricted_until, immunity_cards, permission):
  9. self.user_id = user_id
  10. self.mines = mines
  11. self.death = death
  12. self.wins = wins
  13. self.restricted_until = restricted_until
  14. self.immunity_cards = immunity_cards
  15. self.permission = permission
  16. @staticmethod
  17. def save():
  18. pass
  19. def get_player(user_id):
  20. player = pool.get(user_id, None)
  21. if player is None:
  22. player = Player(user_id=user_id, mines=0, death=0, wins=0,
  23. restricted_until=0, immunity_cards=0, permission=0)
  24. pool[user_id] = player
  25. return player
  26. else:
  27. return player