From 1ae42207f813a7a4ca40bf13f77cce9362f2000d Mon Sep 17 00:00:00 2001 From: Chris Johnston Date: Sat, 4 May 2019 14:08:46 -0700 Subject: [PATCH] feature: Fix #1270 Add the AuthorId to MessageDeleteAuditLogData (#1271) * 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. * Adjust xmldoc wording --- .../DataTypes/MessageDeleteAuditLogData.cs | 14 +++++++++++--- 1 file changed, 11 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 317d47648e..c6b2e10532 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,12 @@ internal static MessageDeleteAuditLogData Create(BaseDiscordClient discord, Mode /// deleted from. /// public ulong ChannelId { get; } + /// + /// Gets the author of the messages that were deleted. + /// + /// + /// A representing the snowflake identifier for the user that created the deleted messages. + /// + public ulong AuthorId { get; } } }