From ec409a0a7b4642dad4de31731b4fa3e0eb7bdc83 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 8 Aug 2025 03:13:30 -0400 Subject: [PATCH] Guard AppCommandThread.guild attribute access --- discord/app_commands/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/app_commands/models.py b/discord/app_commands/models.py index 0b7a697da..1dd004f1d 100644 --- a/discord/app_commands/models.py +++ b/discord/app_commands/models.py @@ -901,7 +901,7 @@ class AppCommandThread(Hashable): def parent(self) -> Optional[Union[ForumChannel, TextChannel]]: """Optional[Union[:class:`~discord.ForumChannel`, :class:`~discord.TextChannel`]]: The parent channel this thread belongs to.""" - return self.guild.get_channel(self.parent_id) # type: ignore + return self.guild and self.guild.get_channel(self.parent_id) # type: ignore @property def flags(self) -> ChannelFlags: @@ -917,7 +917,7 @@ class AppCommandThread(Hashable): .. versionadded:: 2.6 """ - return self.guild.get_member(self.owner_id) # type: ignore + return self.guild and self.guild.get_member(self.owner_id) @property def mention(self) -> str: