Ensure member key is not overwritten by author key in MESSAGE_UPDATE

This also coerces the older message to take the member data from the
newer message so the types are not incompatible.

Fix #5999
This commit is contained in:
Rapptz
2020-11-23 06:02:27 -05:00
parent 7a3a571e0a
commit f174365d33
2 changed files with 17 additions and 7 deletions

View File

@ -526,6 +526,9 @@ class ConnectionState:
raw.cached_message = older_message
self.dispatch('raw_message_edit', raw)
message._update(data)
# Coerce the `after` parameter to take the new updated Member
# ref: #5999
older_message.author = message.author
self.dispatch('message_edit', older_message, message)
else:
self.dispatch('raw_message_edit', raw)