appudiscordbot.py 文件源码

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

项目:Discord-Reddit-Bot 作者: appu1232 项目源码 文件源码
def remove(ctx):
    msg = '**Error** Something went wrong. Are you using the command right? Example use: ``ap:remove anime One Punch Man S2``'
    try:
        toUnfollow = ctx.message.content.split('ap:remove')[1].strip()
        status = removeKeyWords(toUnfollow, ctx.message.author.id)
        if status == True:
            await bot.send_message(ctx.message.channel, 'Successfully removed ``%s`` from ``%s``. View your list with ``ap:list``.' % (toUnfollow.split(' ', 1)[1].strip(), toUnfollow.split(' ', 1)[0].strip()))
            await bot.send_message(discord.Object(id=config["log_location"]),
                                   'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
        elif status == 'blacklist':
            await bot.send_message(ctx.message.channel,
                                   'Successfully removed all words from blacklist. View your list with ``ap:list``.')
            await bot.send_message(discord.Object(id=config["log_location"]),
                                   'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
        else:
            await bot.send_message(ctx.message.channel, msg)
    except Exception as e:
        traceback.print_exc()
        await bot.send_message(ctx.message.channel, msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号