Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Discord.py重写返回错误消息_Python 3.x_Discord.py Rewrite - Fatal编程技术网

Python 3.x Discord.py重写返回错误消息

Python 3.x Discord.py重写返回错误消息,python-3.x,discord.py-rewrite,Python 3.x,Discord.py Rewrite,我想让我的discord机器人做个小动作。然而,当我输入“N”表示“否”时,我得到的是如果我输入“Y”(表示“是”)就会得到的答案。有人能帮忙吗 @client.command() async def shad(ctx): await ctx.send("Do you like Pugs(Reply with Y/N)") def check(m): return m.content in ["Y", "N"] and m.channel == ctx.cha

我想让我的discord机器人做个小动作。然而,当我输入“N”表示“否”时,我得到的是如果我输入“Y”(表示“是”)就会得到的答案。有人能帮忙吗

@client.command()
async def shad(ctx):
    await ctx.send("Do you like Pugs(Reply with Y/N)")


    def check(m):
        return m.content in ["Y", "N"] and m.channel == ctx.channel

    await client.wait_for("message", check=check)
    await ctx.send("Shad does love you")
    if "N" in ctx.content:
        await ctx.send("Shad does not love you")
你可以这么做

@client.command()
async def shad(ctx):
    await ctx.send("Do you like Pugs?[Y/N]")

    awnser = client.wait_for('message', check=lambda message: message.author == ctx.author)
    if awnser in ['Y', 'y', 'yes', 'Yes']:
        #Do something
    else:
        #do something
你可以这么做

@client.command()
async def shad(ctx):
    await ctx.send("Do you like Pugs?[Y/N]")

    awnser = client.wait_for('message', check=lambda message: message.author == ctx.author)
    if awnser in ['Y', 'y', 'yes', 'Yes']:
        #Do something
    else:
        #do something
您总是发送
“Shad does love You”
消息。它可能会在
if
之后的
else
块中。您总是发送
消息“Shad does love You”
。它可能应该在
if
之后的
else
块中。