Let's take a quiz as an example, the user makes the command "/quiz rules" to start a quiz about the rules. How do I then make the bot accept the user's next messages as answers?
Python - nextcord
@client.slash_command(guild_ids=[testing_id])
async def quiz(interaction: Interaction,
value: str = SlashOption(
name="value",
choices=["rules"]
)):
Thank you
So you'll want to add a client event listener and do something when the on_message
event fires.
@client.event
async def on_message(message):
# do something with the message here
So for your quiz example; you'd have to keep track of when a quiz has started, which channel it's in, and which user initiated it (provided you only want a particular user answering) and then parse the message to see if it's an answer to the question it was asked. But using on_message
is what I would do.
You could also use the wait_for
method to wait for a message from a particular user as well.