Check for channel being None. Allow groups to be posted in threads.

This commit is contained in:
2025-03-20 09:50:31 -04:00
parent 1ffb7fa9a7
commit d82999b141
+5 -3
View File
@@ -342,11 +342,13 @@ async def send_highscore_message(session: Session, guild: nextcord.Guild, group:
group (CategoryGroup): group to post to the message.
"""
highscore_string = format_highscore_message(session, group)
channel = guild.get_channel(group.channel_id)
if (channel := guild.get_channel(group.channel_id)) is None:
agon_logger.error("Channel id %s in guild %s does not exist.", group.channel_id, guild.id)
return
if not isinstance(channel, nextcord.TextChannel):
if not isinstance(channel, nextcord.TextChannel) or not isinstance(channel, nextcord.Thread):
agon_logger.error(
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
"Channel id %s in guild %s is does not correspond to a TextChannel or Thread.", channel.id, channel.guild.id
)
return