diff --git a/agon/utils.py b/agon/utils.py index bb4a74c..5fed6db 100644 --- a/agon/utils.py +++ b/agon/utils.py @@ -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