pycord icon indicating copy to clipboard operation
pycord copied to clipboard

`after._raw_data` in `on_message_edit()` does not reflect updated message data

Open BrainlessDip opened this issue 10 months ago • 3 comments

Summary

In the on_message_edit(before, after) event, the after._raw_data attribute appears to contain outdated data — specifically, it reflects the original message content from on_message() rather than the updated content

Reproduction Steps

None

Minimal Reproducible Code

@bot.event
async def on_message_edit(before, after):
   print(before._raw_data['content'])
   print(after._raw_data['content'])

Expected Results

The after._raw_data attribute in on_message_edit should reflect the updated message data (e.g., new content, embeds, etc.) after an edit, similar to how after.content is updated

Actual Results

In the on_message_edit(before, after) event, both after._raw_data and before._raw_data contain the original message content — identical to what was received in the on_message() event — rather than reflecting any edits made to the message

Intents

intents.message_content = True

System Information

  • Python v3.12.9-final
  • py-cord v2.6.1-final
  • aiohttp v3.11.18
  • system info: Linux 6.6.30-android15-8-g94c1a24cabd5-ab12293704-4k #1 SMP PREEMPT Thu Aug 29 05:01:15 UTC 2024

Checklist

  • [x] I have searched the open issues for duplicates.
  • [x] I have shown the entire traceback, if possible.
  • [x] I have removed my token from display, if visible.

Additional Context

No response

BrainlessDip avatar May 06 '25 08:05 BrainlessDip

This is because _raw_data is simply an attribute that is set in the __init__ of Message.

The before and after parameter are Message objects from cache, except after is updated using the _update method.

TLDR: the lib should update the raw data in the _update method.

Soheab avatar May 06 '25 08:05 Soheab

@BrainlessDip you shouldn't close this, it will be closed once the pr is merged

Paillat-dev avatar May 06 '25 13:05 Paillat-dev

@BrainlessDip you shouldn't close this, it will be closed once the pr is merged

Sorry about that, I'm not very familiar with GitHub, but I'll keep it in mind

BrainlessDip avatar May 06 '25 14:05 BrainlessDip