diff --git a/misc.py b/misc.py index c88d418..a17c78c 100644 --- a/misc.py +++ b/misc.py @@ -47,11 +47,19 @@ class misc(commands.Cog): @nextcord.message_command( name="Pin Thread Message", + guild_ids=[732793772697583623], ) async def pinthreadmessage(self, interaction: nextcord.Interaction, message: nextcord.Message): + if message.channel.type != nextcord.ChannelType.public_thread and message.channel.type != nextcord.ChannelType.private_thread: + await interaction.response.send_message("You don't have permission in this context", ephemeral=True) + return if message.channel.owner_id == interaction.user.id: - await message.pin() - await interaction.response.send_message("Pinned", ephemeral=True) + if message.pinned: + await message.pin() + await interaction.response.send_message("Pinned", ephemeral=True) + else: + await message.unpin() + await interaction.response.send_message("Unpinned", ephemeral=True) else: await interaction.response.send_message("You don't have permission in this context", ephemeral=True)