import functools


def manage_channels(func):
    """Decorator that checks for the manage channels permission."""
    @functools.wraps(func)
    async def wrapper(self, *args, **kwargs):
        if hasattr(self, 'tourney'):
            tourney = self.tourney
        else:
            tourney = self
        if not tourney.permissions().manage_channels:
            return
        return await func(self, *args, **kwargs)
    return wrapper