Skip to content

Commit 68f89bf

Browse files
trinitrotoluenefoxbot
authored andcommitted
rest: add webhook model (#1435)
1 parent 5e6f977 commit 68f89bf

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Discord.Models
4+
{
5+
public class Webhook
6+
{
7+
public const int MinWebhookNameLength = 2;
8+
public const int MaxWebhookNameLength = 32;
9+
10+
public const int MinMessageContentLength = 0;
11+
public const int MaxMessageContentLength = 2000;
12+
13+
public const int MinEmbedLimit = 0;
14+
public const int MaxEmbedLimit = 10;
15+
16+
[JsonPropertyName("id")]
17+
public Snowflake Id { get; set; }
18+
[JsonPropertyName("type")]
19+
public WebhookType Type { get; set; }
20+
[JsonPropertyName("guild_id")]
21+
public Optional<Snowflake> GuildId { get; set; }
22+
[JsonPropertyName("channel_id")]
23+
public Snowflake ChannelId { get; set; }
24+
[JsonPropertyName("user")]
25+
public Optional<User> Creator { get; set; }
26+
[JsonPropertyName("name")]
27+
public string? Name { get; set; }
28+
[JsonPropertyName("avatar")]
29+
public string? AvatarId { get; set; }
30+
[JsonPropertyName("token")]
31+
public Optional<string> Token { get; set; }
32+
}
33+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Discord.Models
2+
{
3+
public enum WebhookType : byte
4+
{
5+
Incoming = 1,
6+
ChannelFollower = 2
7+
}
8+
}

0 commit comments

Comments
 (0)