You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
awaitmessage_sent.channel.send(f"Voting for \"{prompt}\" complete. {winner} is the winner with {results[winner]} ({winner_percentage}%) votes!")
397
+
398
+
# Check for ties
399
+
tie=False
400
+
forresultinresults.keys():
401
+
ifresults[result] ==results[winner]:
402
+
tie=True
403
+
404
+
# If there's a tie, find out which results tied and make a string out of them, then print results
405
+
iftie:
406
+
tied_emojis= []
407
+
tie_string=""
408
+
forresultinresults.keys():
409
+
ifresults[result] ==results[winner]:
410
+
tied_emojis.append(result)
411
+
num_ties=len(tied_emojis)
412
+
foriinrange(num_ties-1):
413
+
tie_string+=f"{tied_emojis[i]}, "
414
+
tie_string+=f"and {tied_emojis[i+1]}"
415
+
# Remove comma for only 2 results
416
+
ifnum_ties==2:
417
+
tie_string=tie_string.replace(',', '')
418
+
419
+
awaitmessage_sent.channel.send(f"Voting for \"{prompt}\" complete. There was a {num_ties}-way tie between {tie_string} with {results[winner]} ({winner_percentage}%) votes each.")
0 commit comments