Added WebhookId and IsWebhook

This commit is contained in:
RogueException
2016-10-05 03:43:59 -03:00
parent ca3e7df065
commit 1b86812741
5 changed files with 17 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using Model = Discord.API.Message;
namespace Discord.WebSocket
@@ -17,6 +16,7 @@ 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<IAttachment> Attachments => ImmutableArray.Create<IAttachment>();

View File

@@ -20,8 +20,11 @@ namespace Discord.WebSocket
private ImmutableArray<RestRole> _mentionedRoles;
private ImmutableArray<RestUser> _mentionedUsers;
public ulong? WebhookId { get; private set; }
public override bool IsTTS => _isTTS;
public override bool IsPinned => _isPinned;
public override bool IsWebhook => WebhookId != null;
public override DateTimeOffset? EditedTimestamp => DateTimeUtils.FromTicks(_editedTimestampTicks);
public override IReadOnlyCollection<IAttachment> Attachments => _attachments;
@@ -53,6 +56,8 @@ namespace Discord.WebSocket
_editedTimestampTicks = model.EditedTimestamp.Value?.UtcTicks;
if (model.MentionEveryone.IsSpecified)
_isMentioningEveryone = model.MentionEveryone.Value;
if (model.WebhookId.IsSpecified)
WebhookId = model.WebhookId.Value;
if (model.Attachments.IsSpecified)
{
@@ -133,7 +138,7 @@ namespace Discord.WebSocket
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;
}
}