[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

@@ -9,7 +9,7 @@ namespace Discord
public interface IWebhook : IDeletable, ISnowflakeEntity
{
/// <summary>
/// Gets the token of this webhook.
/// Gets the token of this webhook; <see langword="null"/> if the <see cref="Type"/> is <see cref="WebhookType.ChannelFollower"/>.
/// </summary>
string Token { get; }
@@ -17,10 +17,12 @@ namespace Discord
/// Gets the default name of this webhook.
/// </summary>
string Name { get; }
/// <summary>
/// Gets the ID of this webhook's default avatar.
/// </summary>
string AvatarId { get; }
/// <summary>
/// Gets the URL to this webhook's default avatar.
/// </summary>
@@ -30,10 +32,11 @@ namespace Discord
/// Gets the channel for this webhook.
/// </summary>
IIntegrationChannel Channel { get; }
/// <summary>
/// Gets the ID of the channel for this webhook.
/// Gets the ID of the channel for this webhook; <see langword="null"/> for <see cref="WebhookType.Application"/> webhooks.
/// </summary>
ulong ChannelId { get; }
ulong? ChannelId { get; }
/// <summary>
/// Gets the guild owning this webhook.
@@ -54,6 +57,11 @@ namespace Discord
/// </summary>
ulong? ApplicationId { get; }
/// <summary>
/// Gets the type of this webhook.
/// </summary>
WebhookType Type { get; }
/// <summary>
/// Modifies this webhook.
/// </summary>

View File

@@ -1,14 +1,25 @@
namespace Discord
namespace Discord;
/// <summary>
/// Represents the type of a webhook.
/// </summary>
/// <remarks>
/// This type is currently unused, and is only returned in audit log responses.
/// </remarks>
public enum WebhookType
{
/// <summary>
/// Represents the type of a webhook.
/// An incoming webhook.
/// </summary>
/// <remarks>
/// This type is currently unused, and is only returned in audit log responses.
/// </remarks>
public enum WebhookType
{
/// <summary> An incoming webhook </summary>
Incoming = 1
}
Incoming = 1,
/// <summary>
/// A channel follower webhook.
/// </summary>
ChannelFollower = 2,
/// <summary>
/// An application (interaction) webhook.
/// </summary>
Application = 3,
}