From 47590efef8f45413ea802f3e9bae80e1bd05c855 Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Wed, 20 Feb 2019 23:48:31 -0800 Subject: [PATCH] Fix #1270 Add the AuthorId to MessageDeleteAuditLogData Fix #1270 Adds the AuthorId property to MessageDeleteAuditLogData, which is set by the TargetId in the audit log entry data. This property is the user id that created those messages in the first place. I am not aware of an instance of when this value would not be supplied. --- .../DataTypes/MessageDeleteAuditLogData.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs b/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs index 317d47648..b0114c795 100644 --- a/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs +++ b/src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs @@ -1,4 +1,4 @@ -using Model = Discord.API.AuditLog; +using Model = Discord.API.AuditLog; using EntryModel = Discord.API.AuditLogEntry; namespace Discord.Rest @@ -8,15 +8,16 @@ namespace Discord.Rest /// public class MessageDeleteAuditLogData : IAuditLogData { - private MessageDeleteAuditLogData(ulong channelId, int count) + private MessageDeleteAuditLogData(ulong channelId, int count, ulong authorId) { ChannelId = channelId; MessageCount = count; + AuthorId = authorId; } internal static MessageDeleteAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) { - return new MessageDeleteAuditLogData(entry.Options.MessageDeleteChannelId.Value, entry.Options.MessageDeleteCount.Value); + return new MessageDeleteAuditLogData(entry.Options.MessageDeleteChannelId.Value, entry.Options.MessageDeleteCount.Value, entry.TargetId.Value); } /// @@ -34,5 +35,13 @@ namespace Discord.Rest /// deleted from. /// public ulong ChannelId { get; } + /// + /// Gets the author of the messages that were deleted. + /// + /// + /// A representing the snowflake identifier for the user that the messages were + /// created by. + /// + public ulong AuthorId { get; } } }