So I have the code that makes a bot wait for the user to reply with a specific word, in this case it's "hello". But what if there are multiple things the user can reply with?
What if the bot says "Choose A, B or C". How do I make it wait for the user to reply with one of these answers?
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send(f'Hello {msg.author}!')
CodePudding user response:
Maybe this would work for you
@client.event
async def on_message(message):
if message.content.startswith('$greet'):
channel = message.channel
await channel.send('Choose A, B or C')
def check(m):
return m.content in ['A','B','C'] and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send(f'You choosed {msg.content}!')