当前位置: 首页>>代码示例>>Python>>正文


Python checks.is_owner方法代码示例

本文整理汇总了Python中cogs.utils.checks.is_owner方法的典型用法代码示例。如果您正苦于以下问题:Python checks.is_owner方法的具体用法?Python checks.is_owner怎么用?Python checks.is_owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cogs.utils.checks的用法示例。


在下文中一共展示了checks.is_owner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: elaborate_response

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import is_owner [as 别名]
def elaborate_response(self, trigger, r):
        settings = self.bot.settings
        is_owner = (trigger.owner == settings.owner or
                    trigger.owner in settings.co_owners)
        if not is_owner:
            return "text", r
        if not r.startswith("file:"):
            return "text", r
        else:
            path = r.replace("file:", "").strip()
        path = os.path.join("data", "trigger", "files", path)
        if os.path.isfile(path):
            return "file", path
        else:
            return "text", r 
开发者ID:Twentysix26,项目名称:26-Cogs,代码行数:17,代码来源:trigger.py

示例2: can_edit

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import is_owner [as 别名]
def can_edit(self, user):
        settings = self.bot.settings
        server = user.server
        admin_role = settings.get_server_admin(server)
        # Using the is_owner_check would be better but I don't always have
        # context here, nor I feel like mocking it
        is_owner = user.id == settings.owner or user.id in settings.co_owners
        is_admin = discord.utils.get(user.roles, name=admin_role) is not None
        is_trigger_owner = user.id == self.owner
        trigger_is_global = self.server is None
        if trigger_is_global:
            return is_trigger_owner or is_owner
        else:
            return is_trigger_owner or is_owner or is_admin 
开发者ID:Twentysix26,项目名称:26-Cogs,代码行数:16,代码来源:trigger.py

示例3: cog_check

# 需要导入模块: from cogs.utils import checks [as 别名]
# 或者: from cogs.utils.checks import is_owner [as 别名]
def cog_check(self, ctx):
        """This check is called before running any command from this cog.

        If this returns true, the command can be run, otherwise it can't.

        This is also called when you /help is called, to check if the command is available to the user."""
        # Only the bot owner can use the commands in this cog
        return await checks.is_owner(ctx) 
开发者ID:NabDev,项目名称:NabBot,代码行数:10,代码来源:example.py


注:本文中的cogs.utils.checks.is_owner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。