Удалены избыточные проверки ctx в on_command_error (ctx всегда передан discord.py)
This commit is contained in:
parent
bb9e50fb05
commit
d85f28f042
5
bot.py
5
bot.py
@ -156,7 +156,7 @@ class BotRunner:
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Терминал — детали для разработчика
|
# Терминал — детали для разработчика
|
||||||
cmd_name = ctx.command.name if ctx and ctx.command else "?"
|
cmd_name = ctx.command.name if ctx.command else "?"
|
||||||
logger.error(
|
logger.error(
|
||||||
"Ошибка команды %s: %s",
|
"Ошибка команды %s: %s",
|
||||||
cmd_name,
|
cmd_name,
|
||||||
@ -168,8 +168,7 @@ class BotRunner:
|
|||||||
# ctx.interaction есть только у slash-команд (AutoshardedInteractionContext)
|
# ctx.interaction есть только у slash-команд (AutoshardedInteractionContext)
|
||||||
# Для текстовых команд (!prefix) атрибута нет — используем hasattr
|
# Для текстовых команд (!prefix) атрибута нет — используем hasattr
|
||||||
if (
|
if (
|
||||||
ctx
|
hasattr(ctx, "interaction")
|
||||||
and hasattr(ctx, "interaction")
|
|
||||||
and ctx.interaction
|
and ctx.interaction
|
||||||
and ctx.interaction.response.is_done()
|
and ctx.interaction.response.is_done()
|
||||||
):
|
):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user