mastodon.status_post("Hello @"+account+",\nchallenge an user by writing to me\nCHALL <USERNAME>\nEx. \"CHALL @someone@mastdn.inst.wxyz\"\nThe challenger takes WHITE and begins the match.\nFor movements and jumps, write the coords separated by spaces.\nEx. \"A4 B5\" (normal movement) or \"A4 C6 D8\" (double jump)\nQUIT ends the match.\nCommands are NOT case sensitive..",visibility="direct")
return
ifnotos.path.exists(save_position+account):
ifcontent[:5].lower()=="sfida":
file_save_white=[svforsvinsavesifaccountinsv]
file_save_black=[svforsvinsavesifcontent[:6]insv]
iflen(file_save_white)>0:
mastodon.status_post("Hello @"+account+",\n you're already playing a match")
return
eliflen(file_save_black):
mastodon.status_post("Hello @"+content[7:]+",\n is already playing a match")
return
else:
open(save_position+account,"w").close()
ident=mastodon.status_post("Hello @"+content[7:]+",\n@"+account+" challenged you to a match of draughts! Anzwer \n@"+account+" OK\n to accept the chellenge or \n@"+account+" NO\n to cancel.",visibility="direct")
mastodon.status_post(account+" you cancelled the challenge from "+content.split("")[0],visibility="direct")
return
else:
mastodon.status_post("Hello @"+account+" I can't understand your commend or you're not in a match.\nWrite HELP to see the list of available commands.",visibility="direct")
return
else:
withopen(save_position+account,"rb")asf:
black=pickle.load(f)
white=pickle.load(f)
turn=pickle.load(f)
board=pickle.load(f)
ifcontent.lower()=="quit":
os.remove(save_position+black[1:])
os.remove(save_position+white[1:])
mastodon.status_post(black+""+white+" the match was cancelled.")