Python 3.x Discord.py重写返回错误消息
我想让我的discord机器人做个小动作。然而,当我输入“N”表示“否”时,我得到的是如果我输入“Y”(表示“是”)就会得到的答案。有人能帮忙吗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
@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
块中。