from discord.ext import commands

mod_names = [
    'Moderator', 'Mod',  # classic mod role names
    'moderator', 'mod',  # lowercase mod role names
    # dog specific
    'Dog Moderator', 'Woofer', 'woofer', 'dog moderator',
    'dog mod',
]

def config_is_set(name):
    async def _predicate(ctx):
        return await ctx.bot.config_is_set(ctx.guild, name)

    return commands.check(_predicate)

def global_config_is_set(name):
    async def _predicate(ctx):
        return await ctx.bot.redis.get(name) is not None

    return commands.check(_predicate)

def global_config_is_not_set(name):
    async def _predicate(ctx):
        return await ctx.bot.redis.get(name) is None

    return commands.check(_predicate)

def is_moderator():
    async def _predicate(ctx):
        names = [r.name for r in ctx.author.roles]
        has_moderator_role = any([1 for name in names if name in mod_names])
        return has_moderator_role
    return commands.check(_predicate)

from discord.ext import commands

mod_names = [
    'Moderator', 'Mod',  # classic mod role names
    'moderator', 'mod',  # lowercase mod role names
    # dog specific
    'Dog Moderator', 'Woofer', 'woofer', 'dog moderator',
    'dog mod',
]

def config_is_set(name):
    async def _predicate(ctx):
        return await ctx.bot.config_is_set(ctx.guild, name)

    return commands.check(_predicate)

def global_config_is_set(name):
    async def _predicate(ctx):
        return await ctx.bot.redis.get(name) is not None

    return commands.check(_predicate)

def global_config_is_not_set(name):
    async def _predicate(ctx):
        return await ctx.bot.redis.get(name) is None

    return commands.check(_predicate)

def is_moderator():
    async def _predicate(ctx):
        names = [r.name for r in ctx.author.roles]
        has_moderator_role = any([1 for name in names if name in mod_names])
        has_manage_server = ctx.author.guild_permissions.manage_guild
        is_server_owner = ctx.guild.owner == ctx.author
        return has_moderator_role or has_manage_server or is_server_owner
    return commands.check(_predicate)

make server owner/those with manage server mod