Compare commits

...
Author SHA1 Message Date
imcompiling 12893288f8 Use get_channel_or_thread so that threads can be found.
build_develop / build (push) Successful in 38s
2025-03-21 13:48:54 -04:00
imcompiling 0540f7a9eb Add thread as an option everywhere a textchannel is used.
build_develop / build (push) Successful in 35s
2025-03-20 11:04:00 -04:00
imcompiling a4aab09360 Use or instead of two isinstance calls. 2025-03-20 10:56:59 -04:00
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ class CreateCog(commands.Cog, name="Create Cog"):
min_value=1,
max_value=30,
),
channel: nextcord.TextChannel | None = nextcord.SlashOption(
channel: nextcord.TextChannel | nextcord.Thread | None = nextcord.SlashOption(
description="Channel to post Group in. If left empty, defaults to current channel.",
required=False,
default=None,
+2 -2
View File
@@ -37,7 +37,7 @@ class DeleteCog(commands.Cog, name="Delete Cog"):
async def channel_messages(
self,
interaction: nextcord.Interaction,
channel: nextcord.TextChannel | None = nextcord.SlashOption(
channel: nextcord.TextChannel | nextcord.Thread | None = nextcord.SlashOption(
description="Channel to clear of messages.",
required=False,
default=None,
@@ -54,7 +54,7 @@ class DeleteCog(commands.Cog, name="Delete Cog"):
Is a SlashOption. Limited to text channels. Defaults to None.
"""
if not channel:
if isinstance(interaction.channel, nextcord.TextChannel):
if isinstance(interaction.channel, nextcord.TextChannel | nextcord.Thread):
channel = interaction.channel
else:
# This should never happen.
+1 -1
View File
@@ -103,7 +103,7 @@ class SubmissionCog(commands.Cog):
await interaction.response.send_message(error_response, ephemeral=True)
return
if not isinstance(channel, nextcord.TextChannel):
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
await interaction.response.send_message("An error happened with submission.")
agon_logger.error(
"Channel id %s in guild %s is does not correspond to a TextChannel.", channel.id, channel.guild.id
+1 -1
View File
@@ -43,7 +43,7 @@ class DeleteConfirmView(nextcord.ui.Modal):
session.delete(group)
# delete the message related to group
channel = interaction.guild.get_channel(group.channel_id)
if not isinstance(channel, nextcord.TextChannel):
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
return
message: nextcord.Message = await channel.fetch_message(group.message_id)
await message.delete()
+2 -2
View File
@@ -342,11 +342,11 @@ 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)
if (channel := guild.get_channel(group.channel_id)) is None:
if (channel := guild.get_channel_or_thread(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) or not isinstance(channel, nextcord.Thread):
if not isinstance(channel, nextcord.TextChannel | nextcord.Thread):
agon_logger.error(
"Channel id %s in guild %s is does not correspond to a TextChannel or Thread.", channel.id, channel.guild.id
)