diff options
| author | 2022-07-10 21:42:07 +0100 | |
|---|---|---|
| committer | 2022-07-10 21:42:07 +0100 | |
| commit | efb692ede176fecd3bd1aa848b8ebc0821f6c834 (patch) | |
| tree | 8f1bdd6371b7aae1fca873902078b7a4fad2d94c | |
| parent | Update 3.9-style type hints in config.py (diff) | |
Add support for staff channels that are not in staff categories
| -rw-r--r-- | config-default.toml | 5 | ||||
| -rw-r--r-- | metricity/config.py | 1 | ||||
| -rw-r--r-- | metricity/exts/event_listeners/guild_listeners.py | 5 | 
3 files changed, 8 insertions, 3 deletions
| diff --git a/config-default.toml b/config-default.toml index 1b19124..de8290b 100644 --- a/config-default.toml +++ b/config-default.toml @@ -36,6 +36,11 @@ staff_categories = [      820711852652494868  ] +# Channels that should be flagged as staff only by channel ID +staff_channels =[ +    412375055910043655 +] +  # Don't report messages for the following categories  ignore_categories = [      714494672835444826, diff --git a/metricity/config.py b/metricity/config.py index 2081980..99fd0c2 100644 --- a/metricity/config.py +++ b/metricity/config.py @@ -115,6 +115,7 @@ class BotConfig(metaclass=ConfigSection):      staff_role_id: int      staff_categories: list[int] +    staff_channels: list[int]      ignore_categories: list[int] diff --git a/metricity/exts/event_listeners/guild_listeners.py b/metricity/exts/event_listeners/guild_listeners.py index 18eb79a..67b20bc 100644 --- a/metricity/exts/event_listeners/guild_listeners.py +++ b/metricity/exts/event_listeners/guild_listeners.py @@ -92,9 +92,8 @@ class GuildListeners(commands.Cog):              if not isinstance(channel, discord.CategoryChannel):                  category_id = str(channel.category.id) if channel.category else None                  # Cast to bool so is_staff is False if channel.category is None -                is_staff = bool( -                    channel.category -                    and channel.category.id in BotConfig.staff_categories +                is_staff = channel.id in BotConfig.staff_channels or bool( +                    channel.category and channel.category.id in BotConfig.staff_categories                  )                  if db_chan := await models.Channel.get(str(channel.id)):                      await db_chan.update( | 
