diff options
Diffstat (limited to 'bot')
| -rw-r--r-- | bot/utils/decorators.py | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/bot/utils/decorators.py b/bot/utils/decorators.py index 66b30b97..c12a15ff 100644 --- a/bot/utils/decorators.py +++ b/bot/utils/decorators.py @@ -250,7 +250,18 @@ def whitelist_check(**default_kwargs: t.Container[int]) -> t.Callable[[Context],          )          # Raise error if the check did not pass -        channels = kwargs.get("channels") +        channels = set(kwargs.get("channels") or {}) +        categories = kwargs.get("categories") + +        # Add all whitelisted category channels +        if categories: +            for category_id in categories: +                category = ctx.guild.get_channel(category_id) +                if category is None: +                    continue + +                [channels.add(channel.id) for channel in category.text_channels] +          if channels:              channels_str = ', '.join(f"<#{c_id}>" for c_id in channels)              message = f"Sorry, but you may only use this command within {channels_str}." | 
