tgmsbot/data_ram.py

32 lines
865 B
Python
Raw Permalink Normal View History

2019-01-15 00:57:48 +08:00
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
db = lambda _=None: None
setattr(db, 'close', lambda _=None: None)
2019-01-15 00:57:48 +08:00
pool = dict()
class Player():
def __init__(self, user_id, mines, death, wins,
restricted_until, immunity_cards, permission):
2019-01-15 00:57:48 +08:00
self.user_id = user_id
self.mines = mines
self.death = death
self.wins = wins
self.restricted_until = restricted_until
self.immunity_cards = immunity_cards
self.permission = permission
2019-12-29 18:07:16 +08:00
@staticmethod
def save():
pass
2019-01-15 00:57:48 +08:00
def get_player(user_id):
player = pool.get(user_id, None)
if player is None:
player = Player(user_id=user_id, mines=0, death=0, wins=0,
restricted_until=0, immunity_cards=0, permission=0)
2019-01-15 00:57:48 +08:00
pool[user_id] = player
return player
else:
return player