From 639a43a9d80d546767159cef330f0567ace37132 Mon Sep 17 00:00:00 2001 From: Middledot Date: Sun, 29 Oct 2023 15:20:58 -0400 Subject: [PATCH] chore(commands): don't put partial guild in cache --- discord/interactions.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/discord/interactions.py b/discord/interactions.py index 157c77bca3..aeae830558 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -190,8 +190,9 @@ def _from_data(self, data: InteractionPayload): self.user: User | Member | None = None self._permissions: int = 0 - if (_guild_data := data.get("guild")): - self._state._get_create_guild(_guild_data) + self._guild: Guild | None = None + if self.guild is None and (_guild_data := data.get("guild")): + self._guild = Guild(data=data, state=self) self._guild_data = _guild_data @@ -253,6 +254,8 @@ def client(self) -> Client: @property def guild(self) -> Guild | None: """The guild the interaction was sent from.""" + if self._guild: + return self._guild return self._state and self._state._get_guild(self.guild_id) def is_command(self) -> bool: