Skip to content

Commit

Permalink
Add way to quit
Browse files Browse the repository at this point in the history
  • Loading branch information
NeuroAssassin committed Nov 12, 2018
1 parent c7029cb commit 84687a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion simon/simon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ async def start(self, ctx):
level = [1, 4]
message = await ctx.send("```" + self.print_board(board) + "```")
await message.add_reaction("\u2705")
await message.add_reaction("\u274C")
await ctx.send("Click the Green Check Reaction when you are ready for the sequence.")

def check(reaction, user):
return (user == ctx.author) and str(reaction.emoji) == "\u2705"
return (user == ctx.author) and str(reaction.emoji) in ["\u2705", "\u274C"]

while True:
try:
Expand All @@ -38,6 +39,8 @@ def check(reaction, user):
await ctx.send("Game has ended due to no response for starting the next sequence.")
return
else:
if str(reaction.emoji) == "\u274C":
await message.delete()
await message.remove_reaction('\u2705', self.bot.user)
await message.remove_reaction('\u2705', ctx.author)
await message.add_reaction('\u26A0')
Expand Down Expand Up @@ -96,6 +99,7 @@ def check_t(m):
await ctx.send("Sequence was correct. Waiting for confirmation for another...")
await message.remove_reaction("\U0001F44D", self.bot.user)
await message.add_reaction("\u2705")
await message.add_reaction("\u274C")
level[0] *= 0.90
level[1] += 1

Expand Down

0 comments on commit 84687a3

Please sign in to comment.