DiScord.py Переменные commands.MissingPermissions и commands.MissingRequeredArgument
Короче говоря, я написал код который при ошибке будет писать в чат по типу "User, укажите аргументы!" Но не работает тут только commands.MissingPermissions и commands.MissingRequeredArgument commands.CommandNotFound Работает!
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandNotFound):
await ctx.send(embed = discord.Embed(description = f':negative_squared_cross_mark: ** {ctx.author.name}, команда не найдена!**', colour = discord.Color.red()))
if isinstance(error, MissingPermissions):
await ctx.send(embed = discord.Embed(description = f':negative_squared_cross_mark: ** {ctx.author.name}, у вас нет прав!**', colour = discord.Color.red()))
if isinstance(error, commands.MissingsRequiredArgument):
await ctx.send(embed = discord.Embed(description = f':negative_squared_cross_mark: ** {ctx.authot.name}, укажите аргументы!**', colour = discord.Color.red()))
Сама ошибка
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 847, in invoke
await self.prepare(ctx)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 784, in prepare
await self._parse_arguments(ctx)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 690, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 535, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: amount is a required argument that is missing.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 71, in wrapped
ret = await coro(*args, **kwargs)
File "bot.py", line 99, in clear_error
if isinstance(error, commands.MissingRequiredArqument ):
AttributeError: module 'discord.ext.commands' has no attribute 'MissingRequiredArqument'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 943, in on_message
await self.process_commands(message)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 940, in process_commands
await self.invoke(ctx)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 907, in invoke
await ctx.command.dispatch_error(ctx, exc)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 417, in dispatch_error
await injected(ctx, error)
File "C:\Users\foloi\AppData\Roaming\Python\Python37\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: AttributeError: module 'discord.ext.commands' has no attribute 'MissingRequiredArqument'
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\foloi\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 312, in _run_event
await coro(*args, **kwargs)
File "bot.py", line 22, in on_command_error
if isinstance(error, MissingPermissions):
NameError: name 'MissingPermissions' is not defined
Надеюсь кто-то поmожет <3