“Python Discord Bot attendre la réponse” Réponses codées

Python Discord Bot attendre la réponse

# 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}!")
Ugliest Unicorn

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))
Cloudy Civet

Réponses similaires à “Python Discord Bot attendre la réponse”

Questions similaires à “Python Discord Bot attendre la réponse”

Plus de réponses similaires à “Python Discord Bot attendre la réponse” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code