@@ -12,6 +12,8 @@ namespace Discord.API | |||||
public MessageType Type { get; set; } | public MessageType Type { get; set; } | ||||
[JsonProperty("channel_id")] | [JsonProperty("channel_id")] | ||||
public ulong ChannelId { get; set; } | public ulong ChannelId { get; set; } | ||||
[JsonProperty("webhook_id")] | |||||
public Optional<ulong> WebhookId { get; set; } | |||||
[JsonProperty("author")] | [JsonProperty("author")] | ||||
public Optional<User> Author { get; set; } | public Optional<User> Author { get; set; } | ||||
[JsonProperty("content")] | [JsonProperty("content")] | ||||
@@ -17,6 +17,7 @@ namespace Discord.Rest | |||||
public virtual bool IsTTS => false; | public virtual bool IsTTS => false; | ||||
public virtual bool IsPinned => false; | public virtual bool IsPinned => false; | ||||
public virtual bool IsWebhook => false; | |||||
public virtual DateTimeOffset? EditedTimestamp => null; | public virtual DateTimeOffset? EditedTimestamp => null; | ||||
public virtual IReadOnlyCollection<IAttachment> Attachments => ImmutableArray.Create<IAttachment>(); | public virtual IReadOnlyCollection<IAttachment> Attachments => ImmutableArray.Create<IAttachment>(); | ||||
@@ -18,9 +18,12 @@ namespace Discord.Rest | |||||
private ImmutableArray<ulong> _mentionedChannelIds; | private ImmutableArray<ulong> _mentionedChannelIds; | ||||
private ImmutableArray<RestRole> _mentionedRoles; | private ImmutableArray<RestRole> _mentionedRoles; | ||||
private ImmutableArray<RestUser> _mentionedUsers; | private ImmutableArray<RestUser> _mentionedUsers; | ||||
public ulong? WebhookId { get; private set; } | |||||
public override bool IsTTS => _isTTS; | public override bool IsTTS => _isTTS; | ||||
public override bool IsPinned => _isPinned; | public override bool IsPinned => _isPinned; | ||||
public override bool IsWebhook => WebhookId != null; | |||||
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks); | public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks); | ||||
public override IReadOnlyCollection<IAttachment> Attachments => _attachments; | public override IReadOnlyCollection<IAttachment> Attachments => _attachments; | ||||
@@ -52,6 +55,8 @@ namespace Discord.Rest | |||||
_editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks; | _editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks; | ||||
if (model.MentionEveryone.IsSpecified) | if (model.MentionEveryone.IsSpecified) | ||||
_isMentioningEveryone = model.MentionEveryone.Value; | _isMentioningEveryone = model.MentionEveryone.Value; | ||||
if (model.WebhookId.IsSpecified) | |||||
WebhookId = model.WebhookId.Value; | |||||
if (model.Attachments.IsSpecified) | if (model.Attachments.IsSpecified) | ||||
{ | { | ||||
@@ -131,6 +136,6 @@ namespace Discord.Rest | |||||
return text; | return text; | ||||
} | } | ||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")}"; | |||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})"; | |||||
} | } | ||||
} | } |
@@ -1,7 +1,6 @@ | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Collections.Immutable; | using System.Collections.Immutable; | ||||
using System.Diagnostics; | |||||
using Model = Discord.API.Message; | using Model = Discord.API.Message; | ||||
namespace Discord.WebSocket | namespace Discord.WebSocket | ||||
@@ -17,6 +16,7 @@ namespace Discord.WebSocket | |||||
public virtual bool IsTTS => false; | public virtual bool IsTTS => false; | ||||
public virtual bool IsPinned => false; | public virtual bool IsPinned => false; | ||||
public virtual bool IsWebhook => false; | |||||
public virtual DateTimeOffset? EditedTimestamp => null; | public virtual DateTimeOffset? EditedTimestamp => null; | ||||
public virtual IReadOnlyCollection<IAttachment> Attachments => ImmutableArray.Create<IAttachment>(); | public virtual IReadOnlyCollection<IAttachment> Attachments => ImmutableArray.Create<IAttachment>(); | ||||
@@ -20,8 +20,11 @@ namespace Discord.WebSocket | |||||
private ImmutableArray<RestRole> _mentionedRoles; | private ImmutableArray<RestRole> _mentionedRoles; | ||||
private ImmutableArray<RestUser> _mentionedUsers; | private ImmutableArray<RestUser> _mentionedUsers; | ||||
public ulong? WebhookId { get; private set; } | |||||
public override bool IsTTS => _isTTS; | public override bool IsTTS => _isTTS; | ||||
public override bool IsPinned => _isPinned; | public override bool IsPinned => _isPinned; | ||||
public override bool IsWebhook => WebhookId != null; | |||||
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks); | public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks); | ||||
public override IReadOnlyCollection<IAttachment> Attachments => _attachments; | public override IReadOnlyCollection<IAttachment> Attachments => _attachments; | ||||
@@ -53,6 +56,8 @@ namespace Discord.WebSocket | |||||
_editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks; | _editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks; | ||||
if (model.MentionEveryone.IsSpecified) | if (model.MentionEveryone.IsSpecified) | ||||
_isMentioningEveryone = model.MentionEveryone.Value; | _isMentioningEveryone = model.MentionEveryone.Value; | ||||
if (model.WebhookId.IsSpecified) | |||||
WebhookId = model.WebhookId.Value; | |||||
if (model.Attachments.IsSpecified) | if (model.Attachments.IsSpecified) | ||||
{ | { | ||||
@@ -133,7 +138,7 @@ namespace Discord.WebSocket | |||||
return text; | return text; | ||||
} | } | ||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")}"; | |||||
private string DebuggerDisplay => $"{Author}: {Content} ({Id}{(Attachments.Count > 0 ? $", {Attachments.Count} Attachments" : "")})"; | |||||
internal new SocketUserMessage Clone() => MemberwiseClone() as SocketUserMessage; | internal new SocketUserMessage Clone() => MemberwiseClone() as SocketUserMessage; | ||||
} | } | ||||
} | } |