coowner.py 文件源码

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

项目:Sitryk-Cogs 作者: Sitryk 项目源码 文件源码
def addcommand(self, ctx, *, command):
        """Restricts all co-owners from using [command] """

        confirm = await self._confirm_owner(ctx)
        if not confirm:
            return

        AliasCog = self.bot.get_cog('Alias')
        if AliasCog:
            alias_loaded = False
        else:
            alias_loaded = True
        server = ctx.message.server
        t = True if self.bot.get_command(command) else False
        if not t and alias_loaded:
            t = True if command in AliasCog.aliases[server.id] else False
        if t and command not in self.settings["RESTRICTED"]:
            await self.bot.say("**All owners will be restricted from using**: {}".format(command))
            self.settings["RESTRICTED"].append(command)
            dataIO.save_json(self.path, self.settings)
        elif command in self.settings["RESTRICTED"]:
            await self.bot.say("{} is already a restricted command".format(command))
        else:
            await self.bot.say("{} is not a valid command.".format(command))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号