Answers for "take input discord.py"

1

python discord input

@client.command(name="command")
async def _command(ctx):
    global times_used
    await ctx.send(f"y or n")

    # This will make sure that the response will only be registered if the following
    # conditions are met:
    def check(msg):
        return msg.author == ctx.author and msg.channel == ctx.channel and 
        msg.content.lower() in ["y", "n"]

    msg = await client.wait_for("message", check=check)
    if msg.content.lower() == "y":
        await ctx.send("You said yes!")
    else:
        await ctx.send("You said no!")

    times_used = times_used + 1
Posted by: Guest on December-30-2020
0

discord.py how get user input

playerChoice = await bot.wait_for('message', check=check(context.author), timeout=30)
Posted by: Guest on July-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language