from typing import Callable


def req_perm_admin(func: Callable) -> Callable:
    """A function wrapper that only runs the wrapped function if message.author has the
    administrator permission.

    The wrapped function will return None if message.author does not meet requirements.
    """

    def wrapper(**kwargs):
        message = kwargs["message"]
        perms = message.author.permissions_in(message.channel)
        if getattr(perms, "administrator", False):
            return func(**kwargs)
        return None

    return wrapper