This commit is contained in:
Nikola Petrov 2024-09-04 22:13:15 +02:00
parent 768274f547
commit ab8b138e0c

View File

@ -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]: