From 0fbb58cde9b787dfdc2d027e2d91c6fb450ed2ed Mon Sep 17 00:00:00 2001 From: Rapptz Date: Thu, 7 Jan 2016 01:27:13 -0500 Subject: [PATCH] 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. --- discord/state.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/discord/state.py b/discord/state.py index 06ec6ffb1..3de55a696 100644 --- a/discord/state.py +++ b/discord/state.py @@ -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