Skip to content

Instantly share code, notes, and snippets.

@15696
Created October 17, 2020 21:19
Show Gist options
  • Save 15696/d384e1a1c00a33e4d1d47ff692059baa to your computer and use it in GitHub Desktop.
Save 15696/d384e1a1c00a33e4d1d47ff692059baa to your computer and use it in GitHub Desktop.
a simple example of: commands.Bot.wait_for
bot_msg = await ctx.send("what is 2 + 3?")
def check(message):
return message.channel == bot_msg.channel
try:
msg = bot.wait_for("message", check = check, timeout = 60) # timeout is 60 by default
except asyncio.exceptions.TimeoutError:
# user didnt reply in 60 seconds
else:
# user DID reply
if msg.content == "5":
await ctx.send("yes")
else:
await ctx.send("incorrect")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment