From 0540f7a9eb66b470cb654ea17e7805c762d57217 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Thu, 20 Mar 2025 11:04:00 -0400 Subject: [PATCH] Add thread as an option everywhere a textchannel is used. --- agon/cogs/commands/create.py | 2 +- agon/cogs/commands/delete.py | 4 ++-- agon/cogs/commands/submission.py | 2 +- agon/cogs/commands/views/delete_confirm.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/agon/cogs/commands/create.py b/agon/cogs/commands/create.py index 7b9b0a1..1833d58 100644 --- a/agon/cogs/commands/create.py +++ b/agon/cogs/commands/create.py @@ -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, diff --git a/agon/cogs/commands/delete.py b/agon/cogs/commands/delete.py index 8be1c56..c30aeb3 100644 --- a/agon/cogs/commands/delete.py +++ b/agon/cogs/commands/delete.py @@ -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. diff --git a/agon/cogs/commands/submission.py b/agon/cogs/commands/submission.py index 368769d..2ebbb3e 100644 --- a/agon/cogs/commands/submission.py +++ b/agon/cogs/commands/submission.py @@ -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 diff --git a/agon/cogs/commands/views/delete_confirm.py b/agon/cogs/commands/views/delete_confirm.py index 0655b3e..b909aea 100644 --- a/agon/cogs/commands/views/delete_confirm.py +++ b/agon/cogs/commands/views/delete_confirm.py @@ -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()