Answer the question
In order to leave comments, you need to log in
How to report an HTTPException discord.py error?
I sometimes need the bot to report this error. When I want to import a report, my Python crashes.
Here's how I tried to import:
from discord.ext.commands import HTTPException
(yes, I'm too bad at python, I looked in the documentation, I didn't find anything)
@command.error
async def command_error(ctx, error):
if isinstance(error, MissingRequiredArgument):
await ctx.send('Небыло приведено агрументов')
if isinstance(error, MissingPermissions):
await ctx.send('У вас нет прав')
if isinstance(error, HTTPException):
await ctx.send('Ошибка.')
Answer the question
In order to leave comments, you need to log in
We are looking for an exception in the documentation, and we see that it is in the module discord
, and not in discord.ext.commands
: https://discordpy.readthedocs.io/en/stable/api.htm...
import discord # скорее всего такой импорт у вас уже есть
@command.error
async def command_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send(f'Отсутствует требуемый аргумент: {error.param}')
if isinstance(error, commands.MissingPermissions):
await ctx.send(f'Недостаточно прав: {error.missing_perms}')
if isinstance(error, discord.HTTPException):
await ctx.send(f'Произошла ошибка при запросе: {error.status} ({error.text})')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question