Check for channel being None. Allow groups to be posted in threads.
This commit is contained in:
+5
-3
@@ -342,11 +342,13 @@ async def send_highscore_message(session: Session, guild: nextcord.Guild, group:
|
|||||||
group (CategoryGroup): group to post to the message.
|
group (CategoryGroup): group to post to the message.
|
||||||
"""
|
"""
|
||||||
highscore_string = format_highscore_message(session, group)
|
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(
|
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
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user