Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

event wait for a specified message using pycord

I’m trying to create an event in a command that will wait for a specified user(for me I Will do it on a bot) I tried to do it myself but it didn’t work here’s my code:

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

it didn’t work for some reasons , and If anyone can help me with this I want too to specify what the message contains ! thanks

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>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"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading