【发布时间】:2018-08-06 10:05:29
【问题描述】:
@bot.command(pass_conetext = True)
async def info(ctx, user: discord.Member):
embed = discord.Embed(title = "Super Bot", description = "Thinking" , color = 0x00ff00)
embed.add_field(name = "Name", value = user.name, inline = True)
embed.add_field(name = "ID", value = user.id , inline = True)
embed.add_field(name = "Status", value = user.status , inline = True)
embed.add_field(name = "Highest Role", value = user.top_role , inline = True)
embed.add_field(name = "Joined", value = user.joined_at , inline = True)
embed.set_thumbnail(url = user.avatar_url)
每次我运行这段代码时都会返回这个错误,我不知道为什么
Ignoring exception in command info
Traceback (most recent call last):
File "C:\Users\Stuart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\Stuart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 367, in invoke
yield from self.prepare(ctx)
File "C:\Users\Stuart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 345, in prepare
yield from self._parse_arguments(ctx)
File "C:\Users\Stuart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 304, in _parse_arguments
transformed = yield from self.transform(ctx, param)
File "C:\Users\Stuart\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\ext\commands\core.py", line 212, in transform
raise MissingRequiredArgument('{0.name} is a required argument that is missing.'.format(param))
discord.ext.commands.errors.MissingRequiredArgument: user is a required argument that is missing.
有人能解释一下原因吗,也许是一个解决方案
【问题讨论】:
-
你是如何调用命令的?你在 Discord 中输入什么来运行命令?
-
运行命令是不是
-
你拼错了
pass_conetext,它应该是pass_context。这可能会影响传递给命令的参数 -
已经解决了这个谢谢
标签: python python-3.x error-handling discord.py