NyaChan.py 文件源码

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

项目:nya-chan-bot 作者: OSAlt 项目源码 文件源码
def on_command_error(ctx, error):
    if isinstance(error, discord.ext.commands.errors.CommandNotFound):
        await ctx.author.send(
            "{}, this command does not exist!```{}```".format(ctx.message.author.mention, ctx.message.content))
    elif isinstance(error, discord.ext.commands.errors.NotOwner):
        await ctx.author.send("{}, only my Owner can ask me to do that, nya!```{}```".format(ctx.message.author.mention,
                                                                                             ctx.message.content))
    elif isinstance(error, discord.ext.commands.errors.UserInputError):
        await ctx.author.send(
            "{}, Input error```py\n{}: {}\n```".format(ctx.message.author.mention, type(error).__name__, str(error)))
    elif isinstance(error, discord.ext.commands.errors.NoPrivateMessage):
        await ctx.author.send(
            "{}, this command cannot be send in a PM!```{}```".format(ctx.message.author.mention, ctx.message.content))
    elif isinstance(error, discord.ext.commands.errors.CheckFailure):
        await ctx.author.send(
            "You don\'t have the permission to use this command, {}```{}```".format(ctx.message.author.mention,
                                                                                    ctx.message.content))
    else:
        await ctx.author.send(
            "{}, error```py\n{}: {}\n```".format(ctx.message.author.mention, type(error).__name__, str(error)))
    has_mention = False
    for arg in ctx.args:
        if '@' in str(arg):
            has_mention = True
            break
    if has_mention is True:
        return False
    await ctx.message.delete()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号