using System.Linq;
using Model = Discord.API.AuditLog;
using EntryModel = Discord.API.AuditLogEntry;
namespace Discord.Rest
{
///
/// Contains a piece of audit log data related to a pinned message.
///
public class MessagePinAuditLogData : IAuditLogData
{
private MessagePinAuditLogData(ulong messageId, ulong channelId, IUser user)
{
MessageId = messageId;
ChannelId = channelId;
Target = user;
}
internal static MessagePinAuditLogData Create(BaseDiscordClient discord, Model log, EntryModel entry)
{
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));
}
///
/// Gets the ID of the messages that was pinned.
///
///
/// A representing the snowflake identifier for the messages that was pinned.
///
public ulong MessageId { get; }
///
/// Gets the ID of the channel that the message was pinned from.
///
///
/// A representing the snowflake identifier for the channel that the message was pinned from.
///
public ulong ChannelId { get; }
///
/// Gets the user of the message that was pinned.
///
///
/// A user object representing the user that created the pinned message.
///
public IUser Target { get; }
}
}