Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python discord bot wait for response

# Use Client.wait_for to wait for on_message event.

@commands.command()
async def greet(ctx):
    await ctx.send("Say hello!")

    def check(m):
        return m.content == "hello" and m.channel == channel

    msg = await bot.wait_for("message", check=check)
    await ctx.send(f"Hello {msg.author}!")
Comment

bot wait_for discord py

@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('Hello {.author}!'.format(msg))
Comment

PREVIOUS NEXT
Code Example
Python :: how to pick out separate columns from the pandas dataframe object 
Python :: pip install django 
Python :: ip regex python 
Python :: convert list to string 
Python :: python change column order in dataframe 
Python :: how to merge two dataframes 
Python :: python print class variables 
Python :: first 5 letters of a string python 
Python :: python append to csv on new line 
Python :: glob list all files in directory 
Python :: python regex search group 
Python :: print str and float python 
Python :: python remove nan rows 
Python :: python 3 numbers of a range is even 
Python :: bytes to kb mb gb python 
Python :: python regex get string before character 
Python :: python ndim 
Python :: python how to get the screen size 
Python :: how to hide a turtle in turtle python 
Python :: np.zeros data type not understood 
Python :: python join with int 
Python :: django order by 
Python :: how to make a class in python 
Python :: pause python 
Python :: tkinter progressbar set value 
Python :: tkmessagebox not found 
Python :: python Non-UTF-8 code starting with 
Python :: python remove empty list 
Python :: python manage.py collectstatic --noinput 
Python :: how to change turtle shape in python 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =