def on_command_error(self, ctx, error):
if isinstance(error, commands.NoPrivateMessage):
return await ctx.send('This command cannot be used in private messages.')
if isinstance(error, commands.DisabledCommand):
return await ctx.send('Sorry. This command is disabled and cannot be used.')
if isinstance(error, commands.CommandNotFound):
return await ctx.send('Type `snb?help` for help on valid commands.')
if isinstance(error, errors.StreamNotificationBotError):
return log.error('StreamNotificationBotError: %s', error)
if isinstance(error, commands.CommandInvokeError):
return log.error('CommandInvokeError: %s', error)
tb = ''.join(traceback.format_exception(type(error), error, error.__traceback__))
log.error(f'Command error in %s:\n%s', ctx.command.qualified_name, tb)
评论列表
文章目录