Search code examples
pythondiscord.pypycord

Event wait for a specified message


I'm trying to create an event in a command that will wait for a specified user but it didn't work :

await bot.wait_for('message', check=check("282859044593598464"))
if message.author.id == "282859044593598464":

I want to specify what the message contains.


Solution

  • Use

    def check(message):
       return message.author.id == 282859044593598464
    
    await bot.wait_for('message', check=check)
    

    Then if you want to make more checks, just change the code in the function, and make it so that it return True if it is what you want (for example specific content) and False if it isn't. For example:

    def check(message):
       return message.author.id == 282859044593598464 and message.content=="Here your text"