Skip to content

Conversation

Lumabots
Copy link
Contributor

@Lumabots Lumabots commented Sep 3, 2025

Summary

Here’s a nicely formatted PR draft you can use for your change 👇


📖 Description

This PR fixes an issue in the parse_message_update method where the variable raw was being referenced before assignment when retrieving old_message.

Previously, the method tried to access raw.message_id before raw was defined, causing an unbound variable error.
Now, the method correctly retrieves the message ID directly from data["id"] before creating the RawMessageUpdateEvent.


🔧 Changes Made

  • Updated old_message retrieval to use int(data["id"]) instead of raw.message_id.
  • Ensured raw is created after both old_message and the new Message object are initialized.
  • Maintained existing event dispatch logic (raw_message_edit, message_edit, poll handling, and component tracking).

✅ Why This Fix Matters

  • Prevents runtime errors caused by referencing an uninitialized raw variable.
  • Ensures message updates are processed consistently.
  • Improves code clarity by keeping the order of operations correct.

Information

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed).
  • This PR is not a code change (e.g. documentation, README, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@Lumabots Lumabots requested a review from a team as a code owner September 3, 2025 16:32
@pullapprove4 pullapprove4 bot requested a review from BobDotCom September 3, 2025 16:32
@Lumabots Lumabots changed the title fix: unbound raw Fix: Unbound raw reference in parse_message_update Sep 3, 2025
@Lumabots Lumabots changed the title Fix: Unbound raw reference in parse_message_update fix: Unbound raw reference in parse_message_update Sep 3, 2025
@Paillat-dev
Copy link
Member

Changelog pls

@Lumabots Lumabots requested review from a team as code owners September 3, 2025 16:45
Signed-off-by: Paillat <jeremiecotti@ik.me>
@plun1331
Copy link
Member

plun1331 commented Sep 3, 2025

Here’s a nicely formatted PR draft you can use for your change 👇

@Lulalaby Lulalaby merged commit cbe9944 into Pycord-Development:master Sep 3, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants