def on_error(event_method, *args, **kwargs):
type, value, _traceback = sys.exc_info()
if type is discord.errors.Forbidden:
for arg in args:
if isinstance(arg, commands.context.Context):
print("Missing Permissions for #{0.channel.name} in {0.server.name}".format(arg.message))
return
elif isinstance(arg, discord.Message):
print("Missing Permissions for #{0.channel.name} in {0.server.name}".format(arg))
return
print('Ignoring exception in {}'.format(event_method), file = sys.stderr)
traceback.print_exc()
logging.errors_logger.error("Uncaught exception\n", exc_info = (type, value, _traceback))
评论列表
文章目录