Discord.py on_message()缺少@client.event的参数


async def on_message(ctx,x,op,y):
if ctx.content.startswith("?!solve"):
if op == "+":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " + " + y + " nn") + "Answer: " + str(int(x) + int(y))),
colour=discord.Colour.green()
)
elif op == "-":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " - " + y + " nn") + "Answer: " + str(int(x) -      int(y))),
colour=discord.Colour.green()
)
elif op == "x" or "×":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " x " + y + " nn") + "Answer: " + str(int(x) * int(y))),
colour=discord.Colour.green()
)
elif op == "/":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " / " + y + " nn") + "Answer: " + str(int(x) / int(y))),
colour=discord.Colour.green()
)
else:
await ctx.send("Wrong Argument")
await ctx.channel.send(embed=embed)

它一直说x、op、y缺少参数,而Im使用@client.event因为烧瓶忽略@client.commands((…也许你想知道我为什么需要烧瓶,我使用烧瓶进行全天候机器人托管,所以…请帮助我

这是一个事件,您只传递ONE参数message,如果您想要所有其他参数,则需要使用命令

@client.event
async def on_message(message): # Only this argument
...
await client.process_commands(message)

@client.command()
async def foo(ctx, x, op, y):
...

相关内容

最新更新