botadmin.py 文件源码

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

项目:discordbot.py 作者: rauenzi 项目源码 文件源码
def disable(self, ctx, *, command: str):
        """Disables a command for this server.

        You must have Manage Server permissions or the
        Bot Admin role to use this command.
        """
        command = command.lower()

        if command in ('enable', 'disable'):
            return await self.bot.responses.failure(message='Cannot disable that command.')

        if command not in self.bot.commands:
            return await self.bot.responses.failure(message='Command "{}" was not found.'.format(command))

        guild_id = ctx.message.server.id
        cmds = self.config.get('commands', {})
        entries = cmds.get(guild_id, [])
        entries.append(command)
        cmds[guild_id] = entries
        await self.config.put('commands', cmds)
        await self.bot.responses.success(message='"%s" command disabled in this server.' % command)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号