mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-10 07:49:48 +00:00
Change the way MESSAGE_UPDATE events are handled.
Previously we created a copy of the object and did some strange iteration over the data and set the attributes that we thought were valid. This worked back then in v0.1.0 of the library when it was written, but it no longer works nowadays when we want to be as future proof as possible.
This commit is contained in:
parent
6ddfbc4b36
commit
0fbb58cde9
@ -92,17 +92,7 @@ class ConnectionState:
|
||||
def parse_message_update(self, data):
|
||||
older_message = self._get_message(data.get('id'))
|
||||
if older_message is not None:
|
||||
# create a copy of the new message
|
||||
message = copy.copy(older_message)
|
||||
# update the new update
|
||||
for attr in data:
|
||||
if attr == 'channel_id' or attr == 'author':
|
||||
continue
|
||||
value = data[attr]
|
||||
if 'time' in attr:
|
||||
setattr(message, attr, utils.parse_time(value))
|
||||
else:
|
||||
setattr(message, attr, value)
|
||||
message = Message(channel=older_message.channel, **data)
|
||||
self.dispatch('message_edit', older_message, message)
|
||||
# update the older message
|
||||
older_message = message
|
||||
|
Loading…
x
Reference in New Issue
Block a user