【发布时间】:2022-01-10 09:50:10
【问题描述】:
我想发出看起来像你杀了人的命令
这是我的代码:
@client.command()
async def pew_pew(ctx, targetGuy):
await ctx.reply(targetGuy, "has been pew pew")
b但是当我尝试它说的命令时
忽略命令 pew_pew 中的异常: 回溯(最近一次通话最后): 文件“/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py”,第 994 行,在调用中 等待 ctx.command.invoke(ctx) 文件“/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py”,第 886 行,在调用中 等待 self.prepare(ctx) 准备中的文件“/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py”,第 820 行 等待 self._parse_arguments(ctx) _parse_arguments 中的文件“/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py”,第 726 行 转换 = 等待 self.transform(ctx, param) 文件“/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py”,第 560 行,在转换中 提出 MissingRequiredArgument(param) discord.ext.commands.errors.MissingRequiredArgument:targetGuy 是缺少的必需参数。
【问题讨论】:
-
您在不和谐中使用该命令时是否添加了用户名作为参数?
标签: python python-3.x discord.py