[Feature] Update webhook implementation (#2723)

* initial commit

* add partial guild & channel props

* Apply suggestions from code review

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>

---------

Co-authored-by: Quin Lynch <49576606+quinchs@users.noreply.github.com>
This commit is contained in:
Misha133
2023-08-10 16:14:00 +03:00
committed by GitHub
parent 5c8d83cf85
commit 2b8584d07d
5 changed files with 115 additions and 41 deletions

View File

@@ -13,11 +13,12 @@ namespace Discord.Webhook
public ulong Id { get; }
public string Token { get; }
public ulong ChannelId { get; private set; }
public ulong? ChannelId { get; private set; }
public string Name { get; private set; }
public string AvatarId { get; private set; }
public ulong? GuildId { get; private set; }
public ulong? ApplicationId { get; private set; }
public WebhookType Type { get; private set; }
public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id);
@@ -26,7 +27,7 @@ namespace Discord.Webhook
_client = apiClient;
Id = model.Id;
ChannelId = model.Id;
Token = model.Token;
Token = model.Token.GetValueOrDefault(null);
}
internal static RestInternalWebhook Create(DiscordWebhookClient client, Model model)
{
@@ -46,6 +47,8 @@ namespace Discord.Webhook
if (model.Name.IsSpecified)
Name = model.Name.Value;
Type = model.Type;
ApplicationId = model.ApplicationId;
}