예제 #1
0
 def predicate(ctx):
     roleList = ((ExtFuncs.readVars(
         ctx.guild.id)).get('Roles')).get(roleObj)
     for role in roleList:
         if commands.has_role(role):
             return True
         elif ctx.author == ctx.guild.owner:
             return True
         else:
             continue
     return False
예제 #2
0
 def predicate(ctx):
     items = ((ExtFuncs.readVars(ctx.guild.id)).get('Roles')).get(roleObj)
     if not isinstance(ctx.channel, discord.abc.GuildChannel):
         raise errors.NoPrivateMessage()
     getter = functools.partial(discord.utils.get, ctx.author.roles)
     if any(
             getter(
                 id=item) is not None if isinstance(item, int) else getter(
                     name=item) is not None for item in items):
         return True
     raise errors.MissingAnyRole(items)