Chargement de l'état au démarrage et correction de l'immunité.

This commit is contained in:
klafyvel 2018-01-13 01:02:44 +01:00 committed by root
parent 728464bfa0
commit 889fa1020e

View file

@ -28,6 +28,10 @@ ASSHOLES_FILE = '/var/roulette/assholes'
STATE_FILE = '/var/roulette/state' STATE_FILE = '/var/roulette/state'
STATE = 'down' STATE = 'down'
#Actualisation de l'etat de la roulette
with open(STATE_FILE, 'r') as f:
STATE = f.read()
app = Flask(__name__) app = Flask(__name__)
app.config.from_object(__name__) app.config.from_object(__name__)
@ -170,8 +174,10 @@ def get_players_not_banned():
def cheat(player_id, target_id): def cheat(player_id, target_id):
success = random.choice([True, False]) success = random.choice([True, False])
with open(IMMUNITY_FILE, 'r') as f:
immunity = f.read()
try: try:
ok = [line.strip().partition(' ') for line in IMMUNITY] ok = [line.strip().partition(' ') for line in immunity]
ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok] ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
ko = [line.strip().partition(' ') for line in ASSHOLES] ko = [line.strip().partition(' ') for line in ASSHOLES]