From cf1df454b4982eb5a5ea883597a36af455b1436c Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Tue, 6 May 2025 10:59:54 +0200 Subject: [PATCH 1/4] :bug: Fix `message._raw_data` to be updated when the message is updated --- discord/message.py | 3 +++ discord/state.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/discord/message.py b/discord/message.py index 55a6bfd6b4..502dbc99e9 100644 --- a/discord/message.py +++ b/discord/message.py @@ -1024,6 +1024,9 @@ def _update(self, data): continue else: handler(self, value) + # Update the message's _raw_data + # ref: #2777 + self._raw_data[key] = value # clear the cached properties for attr in self._CACHED_SLOTS: diff --git a/discord/state.py b/discord/state.py index 52a9cc0989..1d31d46f9d 100644 --- a/discord/state.py +++ b/discord/state.py @@ -776,6 +776,8 @@ def parse_message_update(self, data) -> None: message = self._get_message(raw.message_id) if message is not None: older_message = copy.copy(message) + # Copy the raw data because copy.copy will keep references to the same object + message._raw_data = copy.deepcopy(message._raw_data) raw.cached_message = older_message self.dispatch("raw_message_edit", raw) message._update(data) From dce4ae32dd50e576418679d9fa13935680073e38 Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Tue, 6 May 2025 11:01:58 +0200 Subject: [PATCH 2/4] :memo: CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e40955afe..fb11cf8be2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,6 +105,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2746])(https://github.com/Pycord-Development/pycord/pull/2746) - Updated `valid_locales` to support `in` and `es-419`. ([#2767])(https://github.com/Pycord-Development/pycord/pull/2767) +- Fixed `Message._raw_data` do be updated when the message is edited. + ([#2778](https://github.com/Pycord-Development/pycord/pull/2778)) ### Changed From f974f99ab4656d0263a252544628098d1b7ef8e6 Mon Sep 17 00:00:00 2001 From: Paillat-dev Date: Wed, 7 May 2025 23:40:44 +0200 Subject: [PATCH 3/4] :bulb: Remove comment --- discord/message.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/discord/message.py b/discord/message.py index 502dbc99e9..dcfaca0fee 100644 --- a/discord/message.py +++ b/discord/message.py @@ -1024,8 +1024,6 @@ def _update(self, data): continue else: handler(self, value) - # Update the message's _raw_data - # ref: #2777 self._raw_data[key] = value # clear the cached properties From d5d50dd14811dc67da95a1f970cfd87a8151763d Mon Sep 17 00:00:00 2001 From: plun1331 Date: Thu, 8 May 2025 13:50:03 -0700 Subject: [PATCH 4/4] Update CHANGELOG.md Signed-off-by: plun1331 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb11cf8be2..6dbf0cb69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -105,7 +105,7 @@ These changes are available on the `master` branch, but have not yet been releas ([#2746])(https://github.com/Pycord-Development/pycord/pull/2746) - Updated `valid_locales` to support `in` and `es-419`. ([#2767])(https://github.com/Pycord-Development/pycord/pull/2767) -- Fixed `Message._raw_data` do be updated when the message is edited. +- Fixed `Message._raw_data` to be updated when the message is edited. ([#2778](https://github.com/Pycord-Development/pycord/pull/2778)) ### Changed