commandhandler.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ddmbot 作者: Budovi 项目源码 文件源码
def _on_command_error(self, exception, ctx):
        # non-existing commands won't trigger check thus are not deleted
        if isinstance(exception, dec.CommandNotFound) and not isinstance(ctx.message.channel, discord.PrivateChannel):
            await self._bot.client.delete_message(ctx.message)

        # get a cause if the exception was thrown inside the command routine
        if isinstance(exception, dec.CommandInvokeError):
            exception = exception.__cause__

        # now inform the author of the command on the failure using PMs
        await self._bot.client.send_message(ctx.message.author, str(exception))

        # log the error for debugging purposes
        log.debug('Command \'{}\' invoked by {} raised an exception\n{}'
                  .format(ctx.command, ctx.message.author, ctx.message.content), exc_info=exception)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号