diff options
| author | 2020-08-25 11:10:24 -0700 | |
|---|---|---|
| committer | 2020-08-25 11:10:24 -0700 | |
| commit | e1d13efb6d8871a53830860827ac2016a6cc279d (patch) | |
| tree | 595c1080800c883966ac763f445552077f699f19 | |
| parent | Code block: fix conflict with wait_for_deletion args (diff) | |
Use category_id attribute in is_in_category
Simplify the code by removing the need to check if the category is None.
| -rw-r--r-- | bot/utils/channel.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/bot/utils/channel.py b/bot/utils/channel.py index 47f70ce31..851f9e1fe 100644 --- a/bot/utils/channel.py +++ b/bot/utils/channel.py @@ -17,8 +17,7 @@ def is_help_channel(channel: discord.TextChannel) -> bool: def is_in_category(channel: discord.TextChannel, category_id: int) -> bool: """Return True if `channel` is within a category with `category_id`.""" - actual_category = getattr(channel, "category", None) - return actual_category is not None and actual_category.id == category_id + return getattr(channel, "category_id", None) == category_id async def try_get_channel(channel_id: int, client: discord.Client) -> discord.abc.GuildChannel: |