| @@ -10,9 +10,9 @@ namespace Discord.WebSocket | |||||
| public abstract class SocketMessage : SocketEntity<ulong>, IMessage | public abstract class SocketMessage : SocketEntity<ulong>, IMessage | ||||
| { | { | ||||
| private long _timestampTicks; | private long _timestampTicks; | ||||
| public ulong ChannelId { get; } | |||||
| public SocketUser Author { get; } | public SocketUser Author { get; } | ||||
| public ISocketMessageChannel Channel { get; } | |||||
| public string Content { get; private set; } | public string Content { get; private set; } | ||||
| @@ -28,18 +28,18 @@ namespace Discord.WebSocket | |||||
| public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks); | public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks); | ||||
| internal SocketMessage(DiscordSocketClient discord, ulong id, ulong channelId, SocketUser author) | |||||
| internal SocketMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author) | |||||
| : base(discord, id) | : base(discord, id) | ||||
| { | { | ||||
| ChannelId = channelId; | |||||
| Channel = channel; | |||||
| Author = author; | Author = author; | ||||
| } | } | ||||
| internal static SocketMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, Model model) | |||||
| internal static SocketMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, ISocketMessageChannel channel, Model model) | |||||
| { | { | ||||
| if (model.Type == MessageType.Default) | if (model.Type == MessageType.Default) | ||||
| return SocketUserMessage.Create(discord, state, author, model); | |||||
| return SocketUserMessage.Create(discord, state, author, channel, model); | |||||
| else | else | ||||
| return SocketSystemMessage.Create(discord, state, author, model); | |||||
| return SocketSystemMessage.Create(discord, state, author, channel, model); | |||||
| } | } | ||||
| internal virtual void Update(ClientState state, Model model) | internal virtual void Update(ClientState state, Model model) | ||||
| { | { | ||||
| @@ -55,5 +55,7 @@ namespace Discord.WebSocket | |||||
| //IMessage | //IMessage | ||||
| IUser IMessage.Author => Author; | IUser IMessage.Author => Author; | ||||
| MessageType IMessage.Type => MessageType.Default; | MessageType IMessage.Type => MessageType.Default; | ||||
| ulong IMessage.ChannelId => Channel.Id; | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,13 +6,13 @@ namespace Discord.WebSocket | |||||
| { | { | ||||
| public MessageType Type { get; private set; } | public MessageType Type { get; private set; } | ||||
| internal SocketSystemMessage(DiscordSocketClient discord, ulong id, ulong channelId, SocketUser author) | |||||
| : base(discord, id, channelId, author) | |||||
| internal SocketSystemMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author) | |||||
| : base(discord, id, channel, author) | |||||
| { | { | ||||
| } | } | ||||
| internal new static SocketSystemMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, Model model) | |||||
| internal new static SocketSystemMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, ISocketMessageChannel channel, Model model) | |||||
| { | { | ||||
| var entity = new SocketSystemMessage(discord, model.Id, model.ChannelId, author); | |||||
| var entity = new SocketSystemMessage(discord, model.Id, channel, author); | |||||
| entity.Update(state, model); | entity.Update(state, model); | ||||
| return entity; | return entity; | ||||
| } | } | ||||
| @@ -28,13 +28,13 @@ namespace Discord.WebSocket | |||||
| public override IReadOnlyCollection<IRole> MentionedRoles => _mentionedRoles; | public override IReadOnlyCollection<IRole> MentionedRoles => _mentionedRoles; | ||||
| public override IReadOnlyCollection<IUser> MentionedUsers => _mentionedUsers; | public override IReadOnlyCollection<IUser> MentionedUsers => _mentionedUsers; | ||||
| internal SocketUserMessage(DiscordSocketClient discord, ulong id, ulong channelId, SocketUser author) | |||||
| : base(discord, id, channelId, author) | |||||
| internal SocketUserMessage(DiscordSocketClient discord, ulong id, ISocketMessageChannel channel, SocketUser author) | |||||
| : base(discord, id, channel, author) | |||||
| { | { | ||||
| } | } | ||||
| internal new static SocketUserMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, Model model) | |||||
| internal new static SocketUserMessage Create(DiscordSocketClient discord, ClientState state, SocketUser author, ISocketMessageChannel channel, Model model) | |||||
| { | { | ||||
| var entity = new SocketUserMessage(discord, model.Id, model.ChannelId, author); | |||||
| var entity = new SocketUserMessage(discord, model.Id, channel, author); | |||||
| entity.Update(state, model); | entity.Update(state, model); | ||||
| return entity; | return entity; | ||||
| } | } | ||||