aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-02-13 18:52:40 +0000
committerGravatar Chris Lovering <[email protected]>2022-02-13 18:52:40 +0000
commit38a38d37c7cd589ca78a668c6a243a604921333d (patch)
tree011aa413838f9d303e7fd7909cddb99cd4305091
parentOnly sync thread archive status on startup (diff)
Ignore threads in forum channels
Discord.py doesn't support forum channels, so ignore them to avoid tracebacks.
Diffstat (limited to '')
-rw-r--r--metricity/bot.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/metricity/bot.py b/metricity/bot.py
index 4ff44bc..9de690f 100644
--- a/metricity/bot.py
+++ b/metricity/bot.py
@@ -120,6 +120,9 @@ async def sync_channels(guild: Guild) -> None:
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.
+ continue
if db_thread := await Thread.get(str(thread.id)):
await db_thread.update(
@@ -382,11 +385,12 @@ async def on_message(message: DiscordMessage) -> None:
}
if isinstance(message.channel, ThreadChannel):
+ if not message.channel.parent:
+ # This is a forum channel, not currently supported by Discord.py. Ignore it.
+ return
thread = message.channel
args["channel_id"] = str(thread.parent_id)
args["thread_id"] = str(thread.id)
- if not await Thread.get(str(thread.id)):
- await insert_thread(thread)
await Message.create(**args)