| @@ -1,3 +1,5 @@ | |||||
| using System.Linq; | |||||
| using Model = Discord.API.AuditLog; | using Model = Discord.API.AuditLog; | ||||
| using EntryModel = Discord.API.AuditLogEntry; | using EntryModel = Discord.API.AuditLogEntry; | ||||
| @@ -8,22 +10,23 @@ namespace Discord.Rest | |||||
| /// </summary> | /// </summary> | ||||
| public class BotAddAuditLogData : IAuditLogData | public class BotAddAuditLogData : IAuditLogData | ||||
| { | { | ||||
| private BotAddAuditLogData(ulong botId) | |||||
| private BotAddAuditLogData(IUser bot) | |||||
| { | { | ||||
| BotId = botId; | |||||
| Target = bot; | |||||
| } | } | ||||
| internal static BotAddAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | internal static BotAddAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | ||||
| { | { | ||||
| return new BotAddAuditLogData(entry.TargetId.Value); | |||||
| var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId); | |||||
| return new BotAddAuditLogData(RestUser.Create(discord, userInfo)); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets the ID of the bot that was added. | |||||
| /// Gets the bot that was added. | |||||
| /// </summary> | /// </summary> | ||||
| /// <returns> | /// <returns> | ||||
| /// A <see cref="ulong"/> representing the snowflake identifier for the bot that was added. | |||||
| /// A user object representing the bot. | |||||
| /// </returns> | /// </returns> | ||||
| public ulong BotId { get; } | |||||
| public IUser Target { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,3 +1,5 @@ | |||||
| using System.Linq; | |||||
| using Model = Discord.API.AuditLog; | using Model = Discord.API.AuditLog; | ||||
| using EntryModel = Discord.API.AuditLogEntry; | using EntryModel = Discord.API.AuditLogEntry; | ||||
| @@ -8,16 +10,17 @@ namespace Discord.Rest | |||||
| /// </summary> | /// </summary> | ||||
| public class MessageDeleteAuditLogData : IAuditLogData | public class MessageDeleteAuditLogData : IAuditLogData | ||||
| { | { | ||||
| private MessageDeleteAuditLogData(ulong channelId, int count, ulong authorId) | |||||
| private MessageDeleteAuditLogData(ulong channelId, int count, IUser user) | |||||
| { | { | ||||
| ChannelId = channelId; | ChannelId = channelId; | ||||
| MessageCount = count; | MessageCount = count; | ||||
| AuthorId = authorId; | |||||
| Target = user; | |||||
| } | } | ||||
| internal static MessageDeleteAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | internal static MessageDeleteAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | ||||
| { | { | ||||
| return new MessageDeleteAuditLogData(entry.Options.ChannelId.Value, entry.Options.Count.Value, entry.TargetId.Value); | |||||
| var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId); | |||||
| return new MessageDeleteAuditLogData(entry.Options.ChannelId.Value, entry.Options.Count.Value, RestUser.Create(discord, userInfo)); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -36,11 +39,11 @@ namespace Discord.Rest | |||||
| /// </returns> | /// </returns> | ||||
| public ulong ChannelId { get; } | public ulong ChannelId { get; } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets the author of the messages that were deleted. | |||||
| /// Gets the user of the messages that were deleted. | |||||
| /// </summary> | /// </summary> | ||||
| /// <returns> | /// <returns> | ||||
| /// A <see cref="ulong"/> representing the snowflake identifier for the user that created the deleted messages. | |||||
| /// A user object representing the user that created the deleted messages. | |||||
| /// </returns> | /// </returns> | ||||
| public ulong AuthorId { get; } | |||||
| public IUser Target { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,3 +1,5 @@ | |||||
| using System.Linq; | |||||
| using Model = Discord.API.AuditLog; | using Model = Discord.API.AuditLog; | ||||
| using EntryModel = Discord.API.AuditLogEntry; | using EntryModel = Discord.API.AuditLogEntry; | ||||
| @@ -8,16 +10,17 @@ namespace Discord.Rest | |||||
| /// </summary> | /// </summary> | ||||
| public class MessagePinAuditLogData : IAuditLogData | public class MessagePinAuditLogData : IAuditLogData | ||||
| { | { | ||||
| private MessagePinAuditLogData(ulong messageId, ulong channelId, ulong authorId) | |||||
| private MessagePinAuditLogData(ulong messageId, ulong channelId, IUser user) | |||||
| { | { | ||||
| MessageId = messageId; | MessageId = messageId; | ||||
| ChannelId = channelId; | ChannelId = channelId; | ||||
| AuthorId = authorId; | |||||
| Target = user; | |||||
| } | } | ||||
| internal static MessagePinAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | internal static MessagePinAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | ||||
| { | { | ||||
| return new MessagePinAuditLogData(entry.Options.MessageId.Value, entry.Options.ChannelId.Value, entry.TargetId.Value); | |||||
| var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId); | |||||
| return new MessagePinAuditLogData(entry.Options.MessageId.Value, entry.Options.ChannelId.Value, RestUser.Create(discord, userInfo)); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -35,11 +38,11 @@ namespace Discord.Rest | |||||
| /// </returns> | /// </returns> | ||||
| public ulong ChannelId { get; } | public ulong ChannelId { get; } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets the author of the message that was pinned. | |||||
| /// Gets the user of the message that was pinned. | |||||
| /// </summary> | /// </summary> | ||||
| /// <returns> | /// <returns> | ||||
| /// A <see cref="ulong"/> representing the snowflake identifier for the user whose message was pinned. | |||||
| /// A user object representing the user that created the pinned message. | |||||
| /// </returns> | /// </returns> | ||||
| public ulong AuthorId { get; } | |||||
| public IUser Target { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1,3 +1,5 @@ | |||||
| using System.Linq; | |||||
| using Model = Discord.API.AuditLog; | using Model = Discord.API.AuditLog; | ||||
| using EntryModel = Discord.API.AuditLogEntry; | using EntryModel = Discord.API.AuditLogEntry; | ||||
| @@ -8,16 +10,17 @@ namespace Discord.Rest | |||||
| /// </summary> | /// </summary> | ||||
| public class MessageUnpinAuditLogData : IAuditLogData | public class MessageUnpinAuditLogData : IAuditLogData | ||||
| { | { | ||||
| private MessageUnpinAuditLogData(ulong messageId, ulong channelId, ulong authorId) | |||||
| private MessageUnpinAuditLogData(ulong messageId, ulong channelId, IUser user) | |||||
| { | { | ||||
| MessageId = messageId; | MessageId = messageId; | ||||
| ChannelId = channelId; | ChannelId = channelId; | ||||
| AuthorId = authorId; | |||||
| Target = user; | |||||
| } | } | ||||
| internal static MessageUnpinAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | internal static MessageUnpinAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry) | ||||
| { | { | ||||
| return new MessageUnpinAuditLogData(entry.Options.MessageId.Value, entry.Options.ChannelId.Value, entry.TargetId.Value); | |||||
| var userInfo = log.Users.FirstOrDefault(x => x.Id == entry.TargetId); | |||||
| return new MessageUnpinAuditLogData(entry.Options.MessageId.Value, entry.Options.ChannelId.Value, RestUser.Create(discord, userInfo)); | |||||
| } | } | ||||
| /// <summary> | /// <summary> | ||||
| @@ -35,11 +38,11 @@ namespace Discord.Rest | |||||
| /// </returns> | /// </returns> | ||||
| public ulong ChannelId { get; } | public ulong ChannelId { get; } | ||||
| /// <summary> | /// <summary> | ||||
| /// Gets the author of the message that was unpinned. | |||||
| /// Gets the user of the message that was unpinned. | |||||
| /// </summary> | /// </summary> | ||||
| /// <returns> | /// <returns> | ||||
| /// A <see cref="ulong"/> representing the snowflake identifier for the user whose message was unpinned. | |||||
| /// A user object representing the user that created the unpinned message. | |||||
| /// </returns> | /// </returns> | ||||
| public ulong AuthorId { get; } | |||||
| public IUser Target { get; } | |||||
| } | } | ||||
| } | } | ||||