Browse Source

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.
pull/1271/head
Chris Johnston 6 years ago
parent
commit
47590efef8
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs

+ 12
- 3
src/Discord.Net.Rest/Entities/AuditLogs/DataTypes/MessageDeleteAuditLogData.cs View File

@@ -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
/// </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>
@@ -34,5 +35,13 @@ namespace Discord.Rest
/// 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 the messages were
/// created by.
/// </returns>
public ulong AuthorId { get; }
}
}

Loading…
Cancel
Save