Discord.py重写返回错误消息

时间:2019-03-11 19:14:38

标签: python-3.x discord.py-rewrite

我想让我的不和谐机器人做一个小巧的外形。但是,当我输入“ 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")

1 个答案:

答案 0 :(得分:0)

你可以做

@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