diff --git a/rengobot.py b/rengobot.py index 510321e..1bae8c2 100644 --- a/rengobot.py +++ b/rengobot.py @@ -36,6 +36,11 @@ black_stone= "<:black_stone:882730888453046342>" with open("token.txt") as f: token = f.readlines()[0] # Get your own token and put it in token.txt + +if not os.path.exists("state.txt"): + with open("state.txt", "w") as f: + f.write("[]") + format="%Y_%m_%d_%H_%M_%S_%f" # The state is a list of tuples (channel_id, "queue"/"random", last_players, last_times, [black_queue, white_queue]) @@ -397,7 +402,7 @@ async def newgame(ctx, gametype, handicap=0, komi=6.5): # lowest effort serialization with open("state.txt") as f: - state = eval(f.read()) + state = ast.literal_eval(f.read()) if channel_id in [ ch for (ch,_,_,_,_) in state]: