fix(sysadmin): Better exec error message.

This commit is contained in:
2023-08-22 22:37:39 +03:00
parent 6b474f33aa
commit f70c0269c5
2 changed files with 12 additions and 2 deletions

View File

@@ -214,7 +214,7 @@ class LionBot(Bot):
exception.original = HandledException(exception.original) exception.original = HandledException(exception.original)
except CheckFailure as e: except CheckFailure as e:
logger.debug( logger.debug(
f"Command failed check: {e}", f"Command failed check: {e}: {e.args}",
extra={'action': 'BotError', 'with_ctx': True} extra={'action': 'BotError', 'with_ctx': True}
) )
try: try:

View File

@@ -15,6 +15,7 @@ from enum import Enum
import discord import discord
from discord.ext import commands from discord.ext import commands
from discord.ext.commands.errors import CheckFailure
from discord.ui import TextInput, View from discord.ui import TextInput, View
from discord.ui.button import button from discord.ui.button import button
import discord.app_commands as appcmd import discord.app_commands as appcmd
@@ -246,7 +247,16 @@ class Exec(LionCog):
self.talk_async = shard_talk.register_route('exec')(_async) self.talk_async = shard_talk.register_route('exec')(_async)
async def cog_check(self, ctx: LionContext) -> bool: # type: ignore async def cog_check(self, ctx: LionContext) -> bool: # type: ignore
return await sys_admin(ctx.bot, ctx.author.id) passed = await sys_admin(ctx.bot, ctx.author.id)
if passed:
return True
else:
raise CheckFailure(
ctx.bot.translator.t(_p(
'ward:sys_admin|failed',
"You must be a bot owner to do this!"
))
)
@commands.hybrid_command( @commands.hybrid_command(
name=_('async'), name=_('async'),