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

@@ -17,6 +17,7 @@ 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<IAttachment> Attachments => ImmutableArray.Create<IAttachment>();

View File

@@ -18,9 +18,12 @@ namespace Discord.Rest
private ImmutableArray<ulong> _mentionedChannelIds;
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;
@@ -52,6 +55,8 @@ namespace Discord.Rest
_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)
{
@@ -131,6 +136,6 @@ namespace Discord.Rest
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" : "")})";
}
}