aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-06-18 19:02:09 +0100
committerGravatar Chris Lovering <[email protected]>2024-06-18 19:15:31 +0100
commit9219d8435014fdfedc7ad06888f976d61314ab4f (patch)
tree6f8505fe871285e453114ff281bfa2b334ebf42a
parentBump ruff from 0.4.8 to 0.4.9 (#152) (diff)
Ensure thread archive state is also synced when syncing channels
-rw-r--r--metricity/exts/event_listeners/_syncer_utils.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/metricity/exts/event_listeners/_syncer_utils.py b/metricity/exts/event_listeners/_syncer_utils.py
index 258a165..043f1d1 100644
--- a/metricity/exts/event_listeners/_syncer_utils.py
+++ b/metricity/exts/event_listeners/_syncer_utils.py
@@ -113,11 +113,7 @@ async def sync_channels(bot: Bot, guild: discord.Guild) -> None:
async with async_session() as sess:
for thread in guild.threads:
- if thread.parent and thread.parent.category:
- if thread.parent.category.id in BotConfig.ignore_categories:
- continue
- else:
- # This is a forum channel, not currently supported by Discord.py. Ignore it.
+ if thread.parent and thread.parent.category and thread.parent.category.id in BotConfig.ignore_categories:
continue
if db_thread := await sess.get(models.Thread, str(thread.id)):
@@ -130,6 +126,8 @@ async def sync_channels(bot: Bot, guild: discord.Guild) -> None:
insert_thread(thread, sess)
await sess.commit()
+ log.info("Thread synchronisation process complete, synchronising deleted threads")
+ await sync_thread_archive_state(guild)
log.info("Thread synchronisation process complete, finished synchronising guild.")
bot.channel_sync_in_progress.set()