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 + " \n\n") + "Answer: " + str(int(x) + int(y))),
colour=discord.Colour.green()
)
elif op == "-":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " - " + y + " \n\n") + "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 + " \n\n") + "Answer: " + str(int(x) * int(y))),
colour=discord.Colour.green()
)
elif op == "/":
embed = discord.Embed(
title=("Solved!"),
description=("Problem: " + str(x + " / " + y + " \n\n") + "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 缺少参数,我使用 @client.event 因为flask 忽略@client.commands()...也许你想知道为什么我需要flask,我使用flask 进行24/7 机器人托管所以...请帮帮我
答案 0 :(得分:0)
这是一个事件,你只传递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):
...