From a99cceaa8b9327e59c1b4e78c063ec818ae70c29 Mon Sep 17 00:00:00 2001 From: insert Date: Wed, 23 Oct 2024 20:59:33 -0400 Subject: [PATCH] Update --- misc.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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)