From d38c1e0cdc91d5b87787f7022a187e6424e6bdb8 Mon Sep 17 00:00:00 2001 From: Draper <27962761+Drapersniper@users.noreply.github.com> Date: Tue, 7 Feb 2023 20:03:05 +0000 Subject: [PATCH] Fix `AttributeError: 'Thread' object has no attribute 'set_permissions'` Signed-off-by: Draper <27962761+Drapersniper@users.noreply.github.com> --- plcontroller/view.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plcontroller/view.py b/plcontroller/view.py index b4438d139..7fa1a44c2 100644 --- a/plcontroller/view.py +++ b/plcontroller/view.py @@ -389,6 +389,11 @@ async def disable_slow_mode(self) -> None: await self.channel.edit(slowmode_delay=0) async def set_permissions(self) -> bool: + if isinstance(self.channel, discord.Thread): + # Threads don't have permissions, so we can't set them + # We don't want o edit the permissions of the parent channel + # as that would affect the entire channel and all its threads. + return permissions = self.channel.permissions_for(self.channel.guild.me) if permissions.manage_roles or self.guild.me.guild_permissions.manage_roles: default_role_permissions = self.channel.permissions_for(self.channel.guild.default_role)