E
E
ExisterPro2020-10-02 20:23:26
Python
ExisterPro, 2020-10-02 20:23:26

Discord.py how to check if a message is sent from the author?

I made a command, I want to make a confirmation for it. That is, the bot asks something and waits for an answer. How to make the bot process the response as a message ONLY from the author who wrote the command

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-10-02
@fixator10

Client.wait_for(event, *, check, timeout): https://discordpy.readthedocs.io/en/stable/api.htm...

def check(message):
    return message.author.id == ctx.author.id
try:
    m = await bot.wait_for("message", check=check, timeout = 30)
except asyncio.TimeoutError:
    pass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question