diff options
| author | Rapptz <[email protected]> | 2017-05-04 04:26:11 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-05-04 04:35:02 -0400 |
| commit | 86bfcdd1292882fc29346c71edd7177f2cf7b736 (patch) | |
| tree | a16cd0971ea6ef4e524554bbf371cc3323e69d7c /discord/audit_logs.py | |
| parent | Explicitly close UDP sockets when re-creating them. (diff) | |
| download | discord.py-86bfcdd1292882fc29346c71edd7177f2cf7b736.tar.xz discord.py-86bfcdd1292882fc29346c71edd7177f2cf7b736.zip | |
Add support for message delete audit log action type.
Diffstat (limited to 'discord/audit_logs.py')
| -rw-r--r-- | discord/audit_logs.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discord/audit_logs.py b/discord/audit_logs.py index cbd3d3ac..8ac5722b 100644 --- a/discord/audit_logs.py +++ b/discord/audit_logs.py @@ -213,6 +213,13 @@ class AuditLogEntry: if self.action is enums.AuditLogAction.member_prune: # member prune has two keys with useful information self.extra = type('_AuditLogProxy', (), {k: int(v) for k, v in self.extra.items()})() + elif self.action is enums.AuditLogAction.message_delete: + channel_id = int(self.extra['channel_id']) + elems = { + 'count': int(self.extra['count']), + 'channel': self.guild.get_channel(channel_id) or discord.Object(id=channel_id) + } + self.extra = type('_AuditLogProxy', (), elems)() elif self.action.name.startswith('overwrite_'): # the overwrite_ actions have a dict with some information instance_id = int(self.extra['id']) @@ -317,3 +324,6 @@ class AuditLogEntry: def _convert_target_emoji(self, target_id): return self._state.get_emoji(target_id) or Object(id=target_id) + + def _convert_target_message(self, target_id): + return self._get_member(target_id) |