diff --git a/changelog/1267.bugfix.rst b/changelog/1267.bugfix.rst new file mode 100644 index 0000000000..1df3410644 --- /dev/null +++ b/changelog/1267.bugfix.rst @@ -0,0 +1 @@ +Prevent :class:`py:DeprecationWarning` related to :attr:`Message.interaction` field on shard reconnect. diff --git a/disnake/message.py b/disnake/message.py index e4cb7ee0e6..72134988bc 100644 --- a/disnake/message.py +++ b/disnake/message.py @@ -1446,8 +1446,8 @@ def _rebind_cached_references(self, new_guild: Guild, new_channel: GuildMessagea # updated later in _update_member_references, after re-chunking if isinstance(self.author, Member): self.author.guild = new_guild - if self.interaction and isinstance(self.interaction.user, Member): - self.interaction.user.guild = new_guild + if self._interaction and isinstance(self._interaction.user, Member): + self._interaction.user.guild = new_guild @utils.cached_slot_property("_cs_raw_mentions") def raw_mentions(self) -> List[int]: diff --git a/disnake/state.py b/disnake/state.py index 54facfc626..0c1f7238da 100644 --- a/disnake/state.py +++ b/disnake/state.py @@ -2433,10 +2433,10 @@ def _update_member_references(self) -> None: if new_author is not None and new_author is not msg.author: msg.author = new_author - if msg.interaction is not None and isinstance(msg.interaction.user, Member): - new_author = msg.guild.get_member(msg.interaction.user.id) - if new_author is not None and new_author is not msg.interaction.user: - msg.interaction.user = new_author + if msg._interaction is not None and isinstance(msg._interaction.user, Member): + new_author = msg.guild.get_member(msg._interaction.user.id) + if new_author is not None and new_author is not msg._interaction.user: + msg._interaction.user = new_author async def chunker( self,