“Input Perselisihan Python” Kode Jawaban

Input Perselisihan Python

@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

scord.py bagaimana mendapatkan input pengguna

playerChoice = await bot.wait_for('message', check=check(context.author), timeout=30)
Delightful Dragonfly

Jawaban yang mirip dengan “Input Perselisihan Python”

Pertanyaan yang mirip dengan “Input Perselisihan Python”

Lebih banyak jawaban terkait untuk “Input Perselisihan Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya