-
-
Notifications
You must be signed in to change notification settings - Fork 114
/
webhook.ts
64 lines (61 loc) · 1.46 KB
/
webhook.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* Types extracted from https://discord.com/developers/docs/resources/webhook
*/
import type { APIPartialChannel, APIPartialGuild, APIUser } from './mod.ts';
/**
* https://discord.com/developers/docs/resources/webhook#webhook-object
*/
export interface APIWebhook {
/**
* The id of the webhook
*/
id: string;
/**
* The type of the webhook
*
* See https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types
*/
type: WebhookType;
/**
* The guild id this webhook is for
*/
guild_id?: string;
/**
* The channel id this webhook is for
*/
channel_id: string;
/**
* The user this webhook was created by (not returned when getting a webhook with its token)
*
* See https://discord.com/developers/docs/resources/user#user-object
*/
user?: APIUser;
/**
* The default name of the webhook
*/
name: string | null;
/**
* The default avatar of the webhook
*/
avatar: string | null;
/**
* The secure token of the webhook (returned for Incoming Webhooks)
*/
token?: string;
/**
* The bot/OAuth2 application that created this webhook
*/
application_id: string | null;
source_guild?: APIPartialGuild;
source_channel?: APIPartialChannel;
}
export const enum WebhookType {
/**
* Incoming Webhooks can post messages to channels with a generated token
*/
Incoming = 1,
/**
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
*/
ChannelFollower,
}