# Path: bot/users/utils.py
# def has_channel_permission(message, permission):
#     author = message.author
#     permissions = author.permissions_in(message.channel)
#     return getattr(permissions, permission)
# 
# def is_bot_admin(message):
#     """
#     Takes a message and decides whether the author has admin status or not.
#     """
#     author_id = message.author.id
#     qs = Member.objects.filter(discord_id=author_id, can_admin_bot=True)
#     return author_id == settings.OWNER_ID or qs.exists()


from functools import wraps
from .utils import has_channel_permission, is_bot_admin
        @wraps(func)
        async def _wrapped(plugin, command, *args, **kwargs):
            if not check_function(command):
                await command.reply(message)
                return
            await func(plugin, command, *args, **kwargs)
        return _wrapped
    return decorator


def permission_required(permission):
    def decorator(func):
        @wraps(func)
        async def _wrapped(plugin, command, *args, **kwargs):
            if not has_channel_permission(command.message, permission):
                await command.reply('Insufficient permissions: `{}` required'.format(permission))
                return
            await func(plugin, command, *args, **kwargs)
        return _wrapped
    return decorator


def bot_admin_required(func):
    """
    This decorator peforms database lookups, so if you use it,
    the plugin must be marked as ``has_blocking_io = True``.
    """

    @wraps(func)
    async def decorator(plugin, command, *args, **kwargs):

# Path: bot/users/utils.py
# def has_channel_permission(message, permission):
#     author = message.author
#     permissions = author.permissions_in(message.channel)
#     return getattr(permissions, permission)
# 
# def is_bot_admin(message):
#     """
#     Takes a message and decides whether the author has admin status or not.
#     """
#     author_id = message.author.id
#     qs = Member.objects.filter(discord_id=author_id, can_admin_bot=True)
#     return author_id == settings.OWNER_ID or qs.exists()


# Path: bot/users/decorators.py
from functools import wraps
from .utils import has_channel_permission, is_bot_admin

        @wraps(func)
        async def _wrapped(plugin, command, *args, **kwargs):
            if not check_function(command):
                await command.reply(message)
                return
            await func(plugin, command, *args, **kwargs)
        return _wrapped
    return decorator


def permission_required(permission):
    def decorator(func):
        @wraps(func)
        async def _wrapped(plugin, command, *args, **kwargs):
            if not has_channel_permission(command.message, permission):
                await command.reply('Insufficient permissions: `{}` required'.format(permission))
                return
            await func(plugin, command, *args, **kwargs)
        return _wrapped
    return decorator


def bot_admin_required(func):
    """
    This decorator peforms database lookups, so if you use it,
    the plugin must be marked as ``has_blocking_io = True``.
    """

    @wraps(func)
    async def decorator(plugin, command, *args, **kwargs):

        if not is_bot_admin(command.message):