Python 获取discord.ext.commands.errors.CommandInvokeError:

Python 获取discord.ext.commands.errors.CommandInvokeError:,python,Python,我的Python代码: @bot.command(别名=[“crole”,“cr”]) @commands.has_权限(manage_roles=True) 异步def createrole(ctx,*,名称): guild=ctx.guild 等待公会。创建_角色(名称=名称) wait ctx.send(f'Role`{name}`已创建') #创建角色错误 @createrole.error 异步def createrole_错误(self、ctx、error): 如果isinstanc

我的Python代码:

@bot.command(别名=[“crole”,“cr”])
@commands.has_权限(manage_roles=True)
异步def createrole(ctx,*,名称):
guild=ctx.guild
等待公会。创建_角色(名称=名称)
wait ctx.send(f'Role`{name}`已创建')
#创建角色错误
@createrole.error
异步def createrole_错误(self、ctx、error):
如果isinstance(错误,缺少RequiredArgument):
createrole=discord.Embed(
title=f'Command:{prefix}createrole',
颜色=不和谐。颜色。来自_rgb(0,0,0)
)
createrole.add_字段(名称='Description:',值='createa Role',inline=False)
createrole.add_字段(名称='用法:',值=f'`{prefix}createrole[rolename][color]`',内联=False)
createrole.add_字段(name='Example:',value=f'`{prefix}createrole@parth normal`',inline=False)
等待ctx.send(f“{createrole}”)
elif isinstance(错误,commands.BotMissingPermissions):
权限\错误=discord.Embed(描述=f“❌ 我缺少**管理角色**权限”
,color=discord.color.from_rgb(0,0,0))
等待ctx.send(嵌入=权限\错误)
通过发送不完整的命令获取错误>createrole以检查是否发送了my MissingRequiredArgument消息,但获取此错误:

Ignoring exception in on_message
Traceback (most recent call last):
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 847, in invoke
    await self.prepare(ctx)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 784, in prepare
    await self._parse_arguments(ctx)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 699, in _parse_arguments
    kwargs[name] = await self.transform(ctx, param)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 535, in transform
    raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: name is a required argument that is missing.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 71, in wrapped
    ret = await coro(*args, **kwargs)
TypeError: createrole_error() missing 1 required positional argument: 'error'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Mridul Folder\python\lib\site-packages\discord\client.py", line 312, in _run_event
    await coro(*args, **kwargs)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\bot.py", line 943, in on_message
    await self.process_commands(message)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\bot.py", line 940, in process_commands
    await self.invoke(ctx)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\bot.py", line 907, in invoke
    await ctx.command.dispatch_error(ctx, exc)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 417, in dispatch_error
    await injected(ctx, error)
  File "D:\Mridul Folder\python\lib\site-packages\discord\ext\commands\core.py", line 77, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: createrole_error() missing 1 required positional argument: 'error'