當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。