Added WebhookId/IsWebhook to IMessage
This commit is contained in:
@@ -11,6 +11,8 @@ namespace Discord
|
||||
bool IsTTS { get; }
|
||||
/// <summary> Returns true if this message was added to its channel's pinned messages. </summary>
|
||||
bool IsPinned { get; }
|
||||
/// <summary> Returns true if this message was created using a webhook. </summary>
|
||||
bool IsWebhook { get; }
|
||||
/// <summary> Returns the content for this message. </summary>
|
||||
string Content { get; }
|
||||
/// <summary> Gets the time this message was sent. </summary>
|
||||
@@ -22,6 +24,8 @@ namespace Discord
|
||||
ulong ChannelId { get; }
|
||||
/// <summary> Gets the author of this message. </summary>
|
||||
IUser Author { get; }
|
||||
/// <summary> Gets the id of the webhook used to created this message, if any. </summary>
|
||||
ulong? WebhookId { get; }
|
||||
|
||||
/// <summary> Returns all attachments included in this message. </summary>
|
||||
IReadOnlyCollection<IAttachment> Attachments { get; }
|
||||
|
||||
@@ -19,7 +19,6 @@ namespace Discord.Rest
|
||||
|
||||
public virtual bool IsTTS => false;
|
||||
public virtual bool IsPinned => false;
|
||||
public virtual bool IsWebhook => false;
|
||||
public virtual DateTimeOffset? EditedTimestamp => null;
|
||||
public virtual IReadOnlyCollection<Attachment> Attachments => ImmutableArray.Create<Attachment>();
|
||||
public virtual IReadOnlyCollection<Embed> Embeds => ImmutableArray.Create<Embed>();
|
||||
@@ -27,6 +26,8 @@ namespace Discord.Rest
|
||||
public virtual IReadOnlyCollection<ulong> MentionedRoleIds => ImmutableArray.Create<ulong>();
|
||||
public virtual IReadOnlyCollection<RestUser> MentionedUsers => ImmutableArray.Create<RestUser>();
|
||||
public virtual IReadOnlyCollection<ITag> Tags => ImmutableArray.Create<ITag>();
|
||||
public virtual ulong? WebhookId => null;
|
||||
public bool IsWebhook => WebhookId != null;
|
||||
|
||||
public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks);
|
||||
|
||||
|
||||
@@ -14,15 +14,14 @@ namespace Discord.Rest
|
||||
{
|
||||
private bool _isMentioningEveryone, _isTTS, _isPinned;
|
||||
private long? _editedTimestampTicks;
|
||||
private ulong? _webhookId;
|
||||
private ImmutableArray<Attachment> _attachments;
|
||||
private ImmutableArray<Embed> _embeds;
|
||||
private ImmutableArray<ITag> _tags;
|
||||
|
||||
public ulong? WebhookId { get; private set; }
|
||||
|
||||
|
||||
public override bool IsTTS => _isTTS;
|
||||
public override bool IsPinned => _isPinned;
|
||||
public override bool IsWebhook => WebhookId != null;
|
||||
public override ulong? WebhookId => _webhookId;
|
||||
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks);
|
||||
public override IReadOnlyCollection<Attachment> Attachments => _attachments;
|
||||
public override IReadOnlyCollection<Embed> Embeds => _embeds;
|
||||
@@ -55,7 +54,7 @@ namespace Discord.Rest
|
||||
if (model.MentionEveryone.IsSpecified)
|
||||
_isMentioningEveryone = model.MentionEveryone.Value;
|
||||
if (model.WebhookId.IsSpecified)
|
||||
WebhookId = model.WebhookId.Value;
|
||||
_webhookId = model.WebhookId.Value;
|
||||
|
||||
if (model.Attachments.IsSpecified)
|
||||
{
|
||||
|
||||
@@ -17,15 +17,15 @@ namespace Discord.WebSocket
|
||||
|
||||
public virtual bool IsTTS => false;
|
||||
public virtual bool IsPinned => false;
|
||||
public virtual bool IsWebhook => false;
|
||||
public virtual DateTimeOffset? EditedTimestamp => null;
|
||||
|
||||
public virtual IReadOnlyCollection<Attachment> Attachments => ImmutableArray.Create<Attachment>();
|
||||
public virtual IReadOnlyCollection<Embed> Embeds => ImmutableArray.Create<Embed>();
|
||||
public virtual IReadOnlyCollection<SocketGuildChannel> MentionedChannels => ImmutableArray.Create<SocketGuildChannel>();
|
||||
public virtual IReadOnlyCollection<SocketRole> MentionedRoles => ImmutableArray.Create<SocketRole>();
|
||||
public virtual IReadOnlyCollection<SocketUser> MentionedUsers => ImmutableArray.Create<SocketUser>();
|
||||
public virtual IReadOnlyCollection<ITag> Tags => ImmutableArray.Create<ITag>();
|
||||
public virtual ulong? WebhookId => null;
|
||||
public bool IsWebhook => WebhookId != null;
|
||||
|
||||
public DateTimeOffset Timestamp => DateTimeUtils.FromTicks(_timestampTicks);
|
||||
|
||||
|
||||
@@ -14,17 +14,15 @@ namespace Discord.WebSocket
|
||||
{
|
||||
private bool _isMentioningEveryone, _isTTS, _isPinned;
|
||||
private long? _editedTimestampTicks;
|
||||
private ulong? _webhookId;
|
||||
private ImmutableArray<Attachment> _attachments;
|
||||
private ImmutableArray<Embed> _embeds;
|
||||
private ImmutableArray<ITag> _tags;
|
||||
|
||||
public ulong? WebhookId { get; private set; }
|
||||
|
||||
public override bool IsTTS => _isTTS;
|
||||
public override bool IsPinned => _isPinned;
|
||||
public override bool IsWebhook => WebhookId != null;
|
||||
public override ulong? WebhookId => _webhookId;
|
||||
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks);
|
||||
|
||||
public override IReadOnlyCollection<Attachment> Attachments => _attachments;
|
||||
public override IReadOnlyCollection<Embed> Embeds => _embeds;
|
||||
public override IReadOnlyCollection<ITag> Tags => _tags;
|
||||
@@ -56,7 +54,7 @@ namespace Discord.WebSocket
|
||||
if (model.MentionEveryone.IsSpecified)
|
||||
_isMentioningEveryone = model.MentionEveryone.Value;
|
||||
if (model.WebhookId.IsSpecified)
|
||||
WebhookId = model.WebhookId.Value;
|
||||
_webhookId = model.WebhookId.Value;
|
||||
|
||||
if (model.Attachments.IsSpecified)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user