aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Matteo Bertucci <[email protected]>2021-08-22 11:58:27 +0200
committerGravatar GitHub <[email protected]>2021-08-22 11:58:27 +0200
commit310d10b006af3faed831356c341f12ecae17ec1e (patch)
treefc89b1100f86eca2cd4e5be0b29d68274b3e2757
parentMerge pull request #5 from python-discord/drop-deps (diff)
parentPrevent error on uncategorized channel. (diff)
Merge pull request #6 from python-discord/sync-channels-guard-no-category
Prevent error on uncategorized channel.
-rw-r--r--metricity/bot.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/metricity/bot.py b/metricity/bot.py
index 24f80fd..e19bca1 100644
--- a/metricity/bot.py
+++ b/metricity/bot.py
@@ -78,10 +78,9 @@ async def sync_channels(guild: Guild) -> None:
name=channel.name,
category_id=str(channel.category.id) if channel.category else None,
is_staff=(
- True
- if channel.category.id in BotConfig.staff_categories
- else False
- )
+ channel.category
+ and channel.category.id in BotConfig.staff_categories
+ ),
).apply()
else:
await Channel.create(
@@ -89,10 +88,9 @@ async def sync_channels(guild: Guild) -> None:
name=channel.name,
category_id=str(channel.category.id) if channel.category else None,
is_staff=(
- True
- if channel.category.id in BotConfig.staff_categories
- else False
- )
+ channel.category
+ and channel.category.id in BotConfig.staff_categories
+ ),
)
channel_sync_in_progress.set()