1
0
Fork 0
mirror of https://gitlab.com/oloturia/damastodon.git synced 2025-01-07 22:17:15 +01:00

fixed all the glitches

This commit is contained in:
oloturia 2021-10-30 19:14:43 +02:00
parent fa8d751b7c
commit 970954bb28

View file

@ -37,16 +37,16 @@ def check_message(notification):
try: try:
challenged = notification["status"]["mentions"][1]["acct"] challenged = notification["status"]["mentions"][1]["acct"]
except: except:
mastodon.status_post("Hello @"+account+" \n your request is not valid") mastodon.status_post("Hello @"+account+" \n your request is not valid",visibility="direct")
return return
if content[:5].lower() == "chall": if content[:5].lower() == "chall":
file_save_white = [sv for sv in saves if account in sv] file_save_white = [sv for sv in saves if account in sv]
file_save_black = [sv for sv in saves if challenged in sv] file_save_black = [sv for sv in saves if challenged in sv]
if len(file_save_white) > 0: if len(file_save_white) > 0:
mastodon.status_post("Hello @"+account+" \n you're already playing a match") mastodon.status_post("Hello @"+account+" \n you're already playing a match",visibility="direct")
return return
elif len(file_save_black): elif len(file_save_black):
mastodon.status_post("Hello @"+account+" \n the user you challenged is already playing a match") mastodon.status_post("Hello @"+account+" \n the user you challenged is already playing a match",visibility="direct")
return return
else: else:
open(save_position+account,"w").close() open(save_position+account,"w").close()
@ -65,7 +65,7 @@ def check_message(notification):
pickle.dump("@"+challenger,f) pickle.dump("@"+challenger,f)
pickle.dump(False,f) pickle.dump(False,f)
pickle.dump(board,f) pickle.dump(board,f)
mastodon.status_post("◾: @"+account+" ◽: @"+challenger+" turn ◽\n"+dama.draw_checkerboard(board,space="🟥 ",white_norm="",white_knight="",black_norm="",black_knight="",empty="🟦 ",frstrow=firow, column=colsx),visibility="direct") mastodon.status_post("◾: @"+account+" ◽: @"+challenger+" \nturn ◽\n"+dama.draw_checkerboard(board,space="🟥 ",white_norm="",white_knight="",black_norm="",black_knight="",empty="🟦 ",frstrow=firow, column=colsx),visibility="direct")
return return
elif content.split(" ")[1].lower() == "no": elif content.split(" ")[1].lower() == "no":
os.remove(save_position+content.split(" ")[0][1:]) os.remove(save_position+content.split(" ")[0][1:])
@ -103,7 +103,7 @@ def check_message(notification):
colour = "" colour = ""
winner = dama.checkWin(board) winner = dama.checkWin(board)
if winner == (False,False): if winner == (False,False):
mastodon.status_post("◾: "+black+" ◽: "+white+" turn "+colour+"\n"+dama.draw_checkerboard(board,space="🟥 ",white_norm="",white_knight="",black_norm="",black_knight="",empty="🟦 ",frstrow=firow, column=colsx),visibility="direct") mastodon.status_post("◾: "+black+" ◽: "+white+" \nturn "+colour+"\n"+dama.draw_checkerboard(board,space="🟥 ",white_norm="",white_knight="",black_norm="",black_knight="",empty="🟦 ",frstrow=firow, column=colsx),visibility="direct")
return return
else: else:
if winner == (True,False): if winner == (True,False):