-
-
Notifications
You must be signed in to change notification settings - Fork 737
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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>
- Loading branch information
Showing
5 changed files
with
117 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace Discord.API | ||
namespace Discord.API; | ||
|
||
internal class Webhook | ||
{ | ||
internal class Webhook | ||
{ | ||
[JsonProperty("id")] | ||
public ulong Id { get; set; } | ||
[JsonProperty("channel_id")] | ||
public ulong ChannelId { get; set; } | ||
[JsonProperty("token")] | ||
public string Token { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public Optional<string> Name { get; set; } | ||
[JsonProperty("avatar")] | ||
public Optional<string> Avatar { get; set; } | ||
[JsonProperty("guild_id")] | ||
public Optional<ulong> GuildId { get; set; } | ||
|
||
[JsonProperty("user")] | ||
public Optional<User> Creator { get; set; } | ||
[JsonProperty("application_id")] | ||
public ulong? ApplicationId { get; set; } | ||
} | ||
[JsonProperty("id")] | ||
public ulong Id { get; set; } | ||
|
||
[JsonProperty("type")] | ||
public WebhookType Type { get; set; } | ||
|
||
[JsonProperty("guild_id")] | ||
public Optional<ulong?> GuildId { get; set; } | ||
|
||
[JsonProperty("channel_id")] | ||
public ulong? ChannelId { get; set; } | ||
|
||
[JsonProperty("user")] | ||
public Optional<User> Creator { get; set; } | ||
|
||
[JsonProperty("name")] | ||
public Optional<string> Name { get; set; } | ||
|
||
[JsonProperty("avatar")] | ||
public Optional<string> Avatar { get; set; } | ||
|
||
[JsonProperty("token")] | ||
public Optional<string> Token { get; set; } | ||
|
||
[JsonProperty("application_id")] | ||
public ulong? ApplicationId { get; set; } | ||
|
||
[JsonProperty("source_guild")] | ||
public Optional<PartialGuild> Guild { get; set; } | ||
|
||
[JsonProperty("source_channel")] | ||
public Optional<Channel> Channel { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters