appudiscordbot.py 文件源码

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

项目:Discord-Reddit-Bot 作者: appu1232 项目源码 文件源码
def off(ctx):
    if not isFollowing(ctx.message.author.id):
        await bot.send_message(ctx.message.channel, 'Use ``ap:follow`` first to subscribe to the bot. Do ``ap:commands`` for more help')
    else:
        f = open('%susers/user%s.txt' % (path, ctx.message.author.id), 'r+')
        content = f.read()
        f.seek(0)
        if content.startswith('--disable--off'):
            f.write(content)
        elif content.startswith('off'):
            f.write(content)
        elif content.startswith('--disable--'):
            f.write('--disable--off' + content[11:])
        else:
            f.write('off' + content)
        f.close()
        await bot.send_message(ctx.message.channel, 'The bot will no longer ping you on every message. Do ``ap:ping on`` to reverse this.')
        await bot.send_message(discord.Object(id=config["log_location"]),
                               'User: ' + str(ctx.message.author) + '\nCmd: ' + str(ctx.message.content))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号