Skip to content

Commit

Permalink
feature: Fix #1270 Add the AuthorId to MessageDeleteAuditLogData (#1271)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Chris-Johnston authored and foxbot committed May 4, 2019
1 parent 00d3f5a commit 1ae4220
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Model = Discord.API.AuditLog;
using Model = Discord.API.AuditLog;
using EntryModel = Discord.API.AuditLogEntry;

namespace Discord.Rest
Expand All @@ -8,15 +8,16 @@ namespace Discord.Rest
/// </summary>
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);
}

/// <summary>
Expand All @@ -34,5 +35,12 @@ internal static MessageDeleteAuditLogData Create(BaseDiscordClient discord, Mode
/// deleted from.
/// </returns>
public ulong ChannelId { get; }
/// <summary>
/// Gets the author of the messages that were deleted.
/// </summary>
/// <returns>
/// A <see cref="ulong"/> representing the snowflake identifier for the user that created the deleted messages.
/// </returns>
public ulong AuthorId { get; }
}
}

0 comments on commit 1ae4220

Please sign in to comment.