@satorijs/adapter-discord 4.1.3 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -2
- package/lib/utils.d.ts +1 -1
- package/package.json +4 -3
- package/src/bot.ts +221 -0
- package/src/index.ts +27 -0
- package/src/message.ts +446 -0
- package/src/types/.eslintrc.yml +2 -0
- package/src/types/application-role-connection.ts +61 -0
- package/src/types/application.ts +120 -0
- package/src/types/audit-log.ts +219 -0
- package/src/types/auto-moderation.ts +189 -0
- package/src/types/ban.ts +92 -0
- package/src/types/channel.ts +501 -0
- package/src/types/command.ts +320 -0
- package/src/types/component.ts +125 -0
- package/src/types/device.ts +44 -0
- package/src/types/emoji.ts +96 -0
- package/src/types/gateway.ts +334 -0
- package/src/types/guild-member.ts +260 -0
- package/src/types/guild-template.ts +109 -0
- package/src/types/guild.ts +476 -0
- package/src/types/index.ts +49 -0
- package/src/types/integration.ts +130 -0
- package/src/types/interaction.ts +283 -0
- package/src/types/internal.ts +44 -0
- package/src/types/invite.ts +192 -0
- package/src/types/message.ts +470 -0
- package/src/types/presence.ts +163 -0
- package/src/types/reaction.ts +139 -0
- package/src/types/role.ts +252 -0
- package/src/types/scheduled-event.ts +200 -0
- package/src/types/stage-instance.ts +98 -0
- package/src/types/sticker.ts +179 -0
- package/src/types/team.ts +33 -0
- package/src/types/thread.ts +298 -0
- package/src/types/user.ts +154 -0
- package/src/types/voice.ts +124 -0
- package/src/types/webhook.ts +246 -0
- package/src/utils.ts +391 -0
- package/src/ws.ts +124 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { integer, Integration, Internal, snowflake } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-structure */
|
|
4
|
+
export interface User {
|
|
5
|
+
/** the user's id */
|
|
6
|
+
id: snowflake
|
|
7
|
+
/** the user's username, not unique across the platform */
|
|
8
|
+
username: string
|
|
9
|
+
/** the user's 4-digit discord-tag */
|
|
10
|
+
discriminator: string
|
|
11
|
+
/** the user's avatar hash */
|
|
12
|
+
avatar?: string
|
|
13
|
+
/** whether the user belongs to an OAuth2 application */
|
|
14
|
+
bot?: boolean
|
|
15
|
+
/** whether the user is an Official Discord System user (part of the urgent message system) */
|
|
16
|
+
system?: boolean
|
|
17
|
+
/** whether the user has two factor enabled on their account */
|
|
18
|
+
mfa_enabled?: boolean
|
|
19
|
+
/** the user's banner hash */
|
|
20
|
+
banner?: string
|
|
21
|
+
/** the user's banner color encoded as an integer representation of hexadecimal color code */
|
|
22
|
+
accent_color?: integer
|
|
23
|
+
/** the user's chosen language option */
|
|
24
|
+
locale?: string
|
|
25
|
+
/** whether the email on this account has been verified */
|
|
26
|
+
verified?: boolean
|
|
27
|
+
/** the user's email */
|
|
28
|
+
email?: string
|
|
29
|
+
/** the flags on a user's account */
|
|
30
|
+
flags?: integer
|
|
31
|
+
/** the type of Nitro subscription on a user's account */
|
|
32
|
+
premium_type?: PremiumType
|
|
33
|
+
/** the public flags on a user's account */
|
|
34
|
+
public_flags?: integer
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export namespace User {
|
|
38
|
+
export namespace Params {
|
|
39
|
+
/** https://discord.com/developers/docs/resources/user#modify-current-user-json-params */
|
|
40
|
+
export interface Modify {
|
|
41
|
+
/** user's username, if changed may cause the user's discriminator to be randomized. */
|
|
42
|
+
username: string
|
|
43
|
+
/** if passed, modifies the user's avatar */
|
|
44
|
+
avatar?: string
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** https://discord.com/developers/docs/resources/user#user-object-user-flags */
|
|
50
|
+
export enum UserFlag {
|
|
51
|
+
NONE = 0,
|
|
52
|
+
DISCORD_EMPLOYEE = 1 << 0,
|
|
53
|
+
PARTNERED_SERVER_OWNER = 1 << 1,
|
|
54
|
+
HYPESQUAD_EVENTS = 1 << 2,
|
|
55
|
+
BUG_HUNTER_LEVEL_1 = 1 << 3,
|
|
56
|
+
HOUSE_BRAVERY = 1 << 6,
|
|
57
|
+
HOUSE_BRILLIANCE = 1 << 7,
|
|
58
|
+
HOUSE_BALANCE = 1 << 8,
|
|
59
|
+
EARLY_SUPPORTER = 1 << 9,
|
|
60
|
+
TEAM_USER = 1 << 10,
|
|
61
|
+
BUG_HUNTER_LEVEL_2 = 1 << 14,
|
|
62
|
+
VERIFIED_BOT = 1 << 16,
|
|
63
|
+
EARLY_VERIFIED_BOT_DEVELOPER = 1 << 17,
|
|
64
|
+
DISCORD_CERTIFIED_MODERATOR = 1 << 18,
|
|
65
|
+
BOT_HTTP_INTERACTIONS = 1 << 19,
|
|
66
|
+
ACTIVE_DEVELOPER = 1 << 22,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** https://discord.com/developers/docs/resources/user#user-object-premium-types */
|
|
70
|
+
export enum PremiumType {
|
|
71
|
+
NONE = 0,
|
|
72
|
+
NITRO_CLASSIC = 1,
|
|
73
|
+
NITRO = 2,
|
|
74
|
+
NITRO_BASIC = 3,
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** https://discord.com/developers/docs/resources/user#connection-object-connection-structure */
|
|
78
|
+
export interface Connection {
|
|
79
|
+
/** id of the connection account */
|
|
80
|
+
id: string
|
|
81
|
+
/** the username of the connection account */
|
|
82
|
+
name: string
|
|
83
|
+
/** the service of the connection (twitch, youtube) */
|
|
84
|
+
type: string
|
|
85
|
+
/** whether the connection is revoked */
|
|
86
|
+
revoked?: boolean
|
|
87
|
+
/** an array of partial server integrations */
|
|
88
|
+
integrations?: Partial<Integration>[]
|
|
89
|
+
/** whether the connection is verified */
|
|
90
|
+
verified: boolean
|
|
91
|
+
/** whether friend sync is enabled for this connection */
|
|
92
|
+
friend_sync: boolean
|
|
93
|
+
/** whether activities related to this connection will be shown in presence updates */
|
|
94
|
+
show_activity: boolean
|
|
95
|
+
/** whether this connection has a corresponding third party OAuth2 token */
|
|
96
|
+
two_way_link: boolean
|
|
97
|
+
/** visibility of this connection */
|
|
98
|
+
visibility: integer
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** https://discord.com/developers/docs/resources/user#connection-object-visibility-types */
|
|
102
|
+
export enum VisibilityType {
|
|
103
|
+
/** invisible to everyone except the user themselves */
|
|
104
|
+
NONE = 0,
|
|
105
|
+
/** visible to everyone */
|
|
106
|
+
EVERYONE = 1,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface UserUpdateEvent extends User {}
|
|
110
|
+
|
|
111
|
+
declare module './gateway' {
|
|
112
|
+
interface GatewayEvents {
|
|
113
|
+
/** properties about the user changed */
|
|
114
|
+
USER_UPDATE: UserUpdateEvent
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare module './internal' {
|
|
119
|
+
interface Internal {
|
|
120
|
+
/**
|
|
121
|
+
* Returns the user object of the requester's account. For OAuth2, this requires the identify scope, which will return the object without an email, and optionally the email scope, which returns the object with an email.
|
|
122
|
+
* @see https://discord.com/developers/docs/resources/user#get-current-user
|
|
123
|
+
*/
|
|
124
|
+
getCurrentUser(): Promise<User>
|
|
125
|
+
/**
|
|
126
|
+
* Returns a user object for a given user ID.
|
|
127
|
+
* @see https://discord.com/developers/docs/resources/user#get-user
|
|
128
|
+
*/
|
|
129
|
+
getUser(id: snowflake): Promise<User>
|
|
130
|
+
/**
|
|
131
|
+
* Modify the requester's user account settings. Returns a user object on success.
|
|
132
|
+
* @see https://discord.com/developers/docs/resources/user#modify-current-user
|
|
133
|
+
*/
|
|
134
|
+
modifyCurrentUser(params: User.Params.Modify): Promise<User>
|
|
135
|
+
/**
|
|
136
|
+
* Returns a list of connection objects. Requires the connections OAuth2 scope.
|
|
137
|
+
* @see https://discord.com/developers/docs/resources/user#get-user-connections
|
|
138
|
+
*/
|
|
139
|
+
getUserConnections(): Promise<Connection[]>
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Internal.define({
|
|
144
|
+
'/users/@me': {
|
|
145
|
+
GET: 'getCurrentUser',
|
|
146
|
+
PATCH: 'modifyCurrentUser',
|
|
147
|
+
},
|
|
148
|
+
'/users/{user.id}': {
|
|
149
|
+
GET: 'getUser',
|
|
150
|
+
},
|
|
151
|
+
'/users/@me/connections': {
|
|
152
|
+
GET: 'getUserConnections',
|
|
153
|
+
},
|
|
154
|
+
})
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { GuildMember, Internal, snowflake, timestamp } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure */
|
|
4
|
+
export interface VoiceState {
|
|
5
|
+
/** the guild id this voice state is for */
|
|
6
|
+
guild_id?: snowflake
|
|
7
|
+
/** the channel id this user is connected to */
|
|
8
|
+
channel_id?: snowflake
|
|
9
|
+
/** the user id this voice state is for */
|
|
10
|
+
user_id: snowflake
|
|
11
|
+
/** the guild member this voice state is for */
|
|
12
|
+
member?: GuildMember
|
|
13
|
+
/** the session id for this voice state */
|
|
14
|
+
session_id: string
|
|
15
|
+
/** whether this user is deafened by the server */
|
|
16
|
+
deaf: boolean
|
|
17
|
+
/** whether this user is muted by the server */
|
|
18
|
+
mute: boolean
|
|
19
|
+
/** whether this user is locally deafened */
|
|
20
|
+
self_deaf: boolean
|
|
21
|
+
/** whether this user is locally muted */
|
|
22
|
+
self_mute: boolean
|
|
23
|
+
/** whether this user is streaming using "Go Live" */
|
|
24
|
+
self_stream?: boolean
|
|
25
|
+
/** whether this user's camera is enabled */
|
|
26
|
+
self_video: boolean
|
|
27
|
+
/** whether this user is muted by the current user */
|
|
28
|
+
suppress: boolean
|
|
29
|
+
/** the time at which the user requested to speak */
|
|
30
|
+
request_to_speak_timestamp?: timestamp
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export namespace VoiceState {
|
|
34
|
+
export namespace Params {
|
|
35
|
+
/** https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state-json-params */
|
|
36
|
+
export interface ModifyCurrent extends Modify {
|
|
37
|
+
/** sets the user's request to speak */
|
|
38
|
+
request_to_speak_timestamp?: timestamp
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** https://discord.com/developers/docs/resources/guild#modify-user-voice-state-json-params */
|
|
42
|
+
export interface Modify {
|
|
43
|
+
/** the id of the channel the user is currently in */
|
|
44
|
+
channel_id: snowflake
|
|
45
|
+
/** toggles the user's suppress state */
|
|
46
|
+
suppress?: boolean
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** https://discord.com/developers/docs/resources/voice#voice-region-object-voice-region-structure */
|
|
52
|
+
export interface VoiceRegion {
|
|
53
|
+
/** unique ID for the region */
|
|
54
|
+
id: string
|
|
55
|
+
/** name of the region */
|
|
56
|
+
name: string
|
|
57
|
+
/** true for a single server that is closest to the current user's client */
|
|
58
|
+
optimal: boolean
|
|
59
|
+
/** whether this is a deprecated voice region (avoid switching to these) */
|
|
60
|
+
deprecated: boolean
|
|
61
|
+
/** whether this is a custom voice region (used for events/etc) */
|
|
62
|
+
custom: boolean
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface VoiceStateUpdateEvent extends VoiceState {}
|
|
66
|
+
|
|
67
|
+
/** https://discord.com/developers/docs/topics/gateway-events#voice-server-update-voice-server-update-event-fields */
|
|
68
|
+
export interface VoiceServerUpdateEvent {
|
|
69
|
+
/** voice connection token */
|
|
70
|
+
token: string
|
|
71
|
+
/** the guild this voice server update is for */
|
|
72
|
+
guild_id: snowflake
|
|
73
|
+
/** the voice server host */
|
|
74
|
+
endpoint?: string
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare module './gateway' {
|
|
78
|
+
interface GatewayEvents {
|
|
79
|
+
/** someone joined, left, or moved a voice channel */
|
|
80
|
+
VOICE_STATE_UPDATE: VoiceStateUpdateEvent
|
|
81
|
+
/** guild's voice server was updated */
|
|
82
|
+
VOICE_SERVER_UPDATE: VoiceServerUpdateEvent
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare module './internal' {
|
|
87
|
+
interface Internal {
|
|
88
|
+
/**
|
|
89
|
+
* Returns an array of voice region objects that can be used when setting a voice or stage channel's rtc_region.
|
|
90
|
+
* @see https://discord.com/developers/docs/resources/voice#list-voice-regions
|
|
91
|
+
*/
|
|
92
|
+
listVoiceRegions(): Promise<VoiceRegion[]>
|
|
93
|
+
/**
|
|
94
|
+
* Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled.
|
|
95
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-voice-regions
|
|
96
|
+
*/
|
|
97
|
+
getGuildVoiceRegions(guild_id: snowflake): Promise<VoiceRegion[]>
|
|
98
|
+
/**
|
|
99
|
+
* Updates the current user's voice state.
|
|
100
|
+
* @see https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
|
|
101
|
+
*/
|
|
102
|
+
modifyCurrentUserVoiceState(guild_id: snowflake, params: VoiceState.Params.ModifyCurrent): Promise<VoiceState>
|
|
103
|
+
/**
|
|
104
|
+
* Updates another user's voice state.
|
|
105
|
+
* @see https://discord.com/developers/docs/resources/guild#modify-user-voice-state
|
|
106
|
+
*/
|
|
107
|
+
modifyUserVoiceState(guild_id: snowflake, user_id: snowflake, params: VoiceState.Params.Modify): Promise<VoiceState>
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
Internal.define({
|
|
112
|
+
'/voice/regions': {
|
|
113
|
+
GET: 'listVoiceRegions',
|
|
114
|
+
},
|
|
115
|
+
'/guilds/{guild.id}/regions': {
|
|
116
|
+
GET: 'getGuildVoiceRegions',
|
|
117
|
+
},
|
|
118
|
+
'/guilds/{guild.id}/voice-states/@me': {
|
|
119
|
+
PATCH: 'modifyCurrentUserVoiceState',
|
|
120
|
+
},
|
|
121
|
+
'/guilds/{guild.id}/voice-states/{user.id}': {
|
|
122
|
+
PATCH: 'modifyUserVoiceState',
|
|
123
|
+
},
|
|
124
|
+
})
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { AllowedMentions, Attachment, Channel, Component, Embed, Guild, integer, Internal, Message, snowflake, User } from '.'
|
|
2
|
+
|
|
3
|
+
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
|
|
4
|
+
export interface Webhook {
|
|
5
|
+
/** the id of the webhook */
|
|
6
|
+
id: snowflake
|
|
7
|
+
/** the type of the webhook */
|
|
8
|
+
type: Webhook.Type
|
|
9
|
+
/** the guild id this webhook is for, if any */
|
|
10
|
+
guild_id?: snowflake
|
|
11
|
+
/** the channel id this webhook is for, if any */
|
|
12
|
+
channel_id?: snowflake
|
|
13
|
+
/** the user this webhook was created by (not returned when getting a webhook with its token) */
|
|
14
|
+
user?: User
|
|
15
|
+
/** the default name of the webhook */
|
|
16
|
+
name?: string
|
|
17
|
+
/** the default user avatar hash of the webhook */
|
|
18
|
+
avatar?: string
|
|
19
|
+
/** the secure token of the webhook (returned for Incoming Webhooks) */
|
|
20
|
+
token?: string
|
|
21
|
+
/** the bot/OAuth2 application that created this webhook */
|
|
22
|
+
application_id?: snowflake
|
|
23
|
+
/** the guild of the channel that this webhook is following (returned for Channel Follower Webhooks) */
|
|
24
|
+
source_guild?: Partial<Guild>
|
|
25
|
+
/** the channel that this webhook is following (returned for Channel Follower Webhooks) */
|
|
26
|
+
source_channel?: Partial<Channel>
|
|
27
|
+
/** the url used for executing the webhook (returned by the webhooks OAuth2 flow) */
|
|
28
|
+
url?: string
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export namespace Webhook {
|
|
32
|
+
/** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types */
|
|
33
|
+
export enum Type {
|
|
34
|
+
/** Incoming Webhooks can post messages to channels with a generated token */
|
|
35
|
+
INCOMING = 1,
|
|
36
|
+
/** Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels */
|
|
37
|
+
CHANNEL_FOLLOWER = 2,
|
|
38
|
+
/** Application webhooks are webhooks used with Interactions */
|
|
39
|
+
APPLICATION = 3,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** https://discord.com/developers/docs/resources/webhook#create-webhook-json-params */
|
|
43
|
+
export interface CreateParams {
|
|
44
|
+
/** name of the webhook (1-80 characters) */
|
|
45
|
+
name: string
|
|
46
|
+
/** image for the default webhook avatar */
|
|
47
|
+
avatar?: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** https://discord.com/developers/docs/resources/webhook#modify-webhook-json-params */
|
|
51
|
+
export interface ModifyParams {
|
|
52
|
+
/** the default name of the webhook */
|
|
53
|
+
name: string
|
|
54
|
+
/** image for the default webhook avatar */
|
|
55
|
+
avatar?: string
|
|
56
|
+
/** the new channel id this webhook should be moved to */
|
|
57
|
+
channel_id: snowflake
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-webhook-query-string-params */
|
|
61
|
+
export interface ExecuteParams {
|
|
62
|
+
/** waits for server confirmation of message send before response, and returns the created message body (defaults to false; when false a message that is not saved does not return an error) */
|
|
63
|
+
wait: boolean
|
|
64
|
+
/** Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived. */
|
|
65
|
+
thread_id: snowflake
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params */
|
|
69
|
+
export interface ExecuteBody {
|
|
70
|
+
/** the message contents (up to 2000 characters) */
|
|
71
|
+
content: string
|
|
72
|
+
/** override the default username of the webhook */
|
|
73
|
+
username: string
|
|
74
|
+
/** override the default avatar of the webhook */
|
|
75
|
+
avatar_url: string
|
|
76
|
+
/** true if this is a TTS message */
|
|
77
|
+
tts: boolean
|
|
78
|
+
/** embedded rich content */
|
|
79
|
+
embeds: Embed[]
|
|
80
|
+
/** allowed mentions for the message */
|
|
81
|
+
allowed_mentions: AllowedMentions
|
|
82
|
+
/** the components to include with the message */
|
|
83
|
+
components: Component[]
|
|
84
|
+
/** the contents of the file being sent */
|
|
85
|
+
files: any
|
|
86
|
+
/** JSON encoded body of non-file params */
|
|
87
|
+
payload_json: string
|
|
88
|
+
/** attachment objects with filename and description */
|
|
89
|
+
attachments: Partial<Attachment>[]
|
|
90
|
+
/** message flags combined as a bitfield (only SUPPRESS_EMBEDS can be set) */
|
|
91
|
+
flags: integer
|
|
92
|
+
/** name of thread to create (requires the webhook channel to be a forum channel) */
|
|
93
|
+
thread_name: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** https://discord.com/developers/docs/resources/webhook#get-webhook-message-query-string-params */
|
|
97
|
+
export interface MessageParams {
|
|
98
|
+
/** id of the thread the message is in */
|
|
99
|
+
thread_id: snowflake
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** https://discord.com/developers/docs/resources/webhook#edit-webhook-message-jsonform-params */
|
|
103
|
+
export interface MessageBody {
|
|
104
|
+
/** the message contents (up to 2000 characters) */
|
|
105
|
+
content: string
|
|
106
|
+
/** embedded rich content */
|
|
107
|
+
embeds: Embed[]
|
|
108
|
+
/** allowed mentions for the message */
|
|
109
|
+
allowed_mentions: AllowedMentions
|
|
110
|
+
/** the components to include with the message */
|
|
111
|
+
components: Component[]
|
|
112
|
+
/** the contents of the file being sent/edited */
|
|
113
|
+
files: any
|
|
114
|
+
/** JSON encoded body of non-file params (multipart/form-data only) */
|
|
115
|
+
payload_json: string
|
|
116
|
+
/** attached files to keep and possible descriptions for new files */
|
|
117
|
+
attachments: Partial<Attachment>[]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** https://discord.com/developers/docs/topics/gateway-events#webhooks-update-webhooks-update-event-fields */
|
|
122
|
+
export interface WebhooksUpdateEvent {
|
|
123
|
+
/** id of the guild */
|
|
124
|
+
guild_id: snowflake
|
|
125
|
+
/** id of the channel */
|
|
126
|
+
channel_id: snowflake
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
declare module './gateway' {
|
|
130
|
+
interface GatewayEvents {
|
|
131
|
+
/** guild channel webhook was created, update, or deleted */
|
|
132
|
+
WEBHOOKS_UPDATE: WebhooksUpdateEvent
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
declare module './internal' {
|
|
137
|
+
interface Internal {
|
|
138
|
+
/**
|
|
139
|
+
* Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
|
|
140
|
+
* @see https://discord.com/developers/docs/resources/webhook#create-webhook
|
|
141
|
+
*/
|
|
142
|
+
createWebhook(channel_id: snowflake, params: Webhook.CreateParams): Promise<Webhook>
|
|
143
|
+
/**
|
|
144
|
+
* Returns a list of channel webhook objects. Requires the MANAGE_WEBHOOKS permission.
|
|
145
|
+
* @see https://discord.com/developers/docs/resources/webhook#get-channel-webhooks
|
|
146
|
+
*/
|
|
147
|
+
getChannelWebhooks(channel_id: snowflake): Promise<Webhook[]>
|
|
148
|
+
/**
|
|
149
|
+
* Returns a list of guild webhook objects. Requires the MANAGE_WEBHOOKS permission.
|
|
150
|
+
* @see https://discord.com/developers/docs/resources/webhook#get-guild-webhooks
|
|
151
|
+
*/
|
|
152
|
+
getGuildWebhooks(guild_id: snowflake): Promise<Webhook[]>
|
|
153
|
+
/**
|
|
154
|
+
* Returns the new webhook object for the given id.
|
|
155
|
+
* @see https://discord.com/developers/docs/resources/webhook#get-webhook
|
|
156
|
+
*/
|
|
157
|
+
getWebhook(webhook_id: snowflake): Promise<Webhook>
|
|
158
|
+
/**
|
|
159
|
+
* Same as above, except this call does not require authentication and returns no user in the webhook object.
|
|
160
|
+
* @see https://discord.com/developers/docs/resources/webhook#get-webhook-with-token
|
|
161
|
+
*/
|
|
162
|
+
getWebhookWithToken(webhook_id: snowflake, token: string): Promise<Webhook>
|
|
163
|
+
/**
|
|
164
|
+
* Modify a webhook. Requires the MANAGE_WEBHOOKS permission. Returns the updated webhook object on success.
|
|
165
|
+
* @see https://discord.com/developers/docs/resources/webhook#modify-webhook
|
|
166
|
+
*/
|
|
167
|
+
modifyWebhook(webhook_id: snowflake, params: Webhook.ModifyParams): Promise<Webhook>
|
|
168
|
+
/**
|
|
169
|
+
* Same as above, except this call does not require authentication, does not accept a channel_id parameter in the body, and does not return a user in the webhook object.
|
|
170
|
+
* @see https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token
|
|
171
|
+
*/
|
|
172
|
+
modifyWebhookWithToken(webhook_id: snowflake, token: string, params: Webhook.ModifyParams): Promise<Webhook>
|
|
173
|
+
/**
|
|
174
|
+
* Delete a webhook permanently. Requires the MANAGE_WEBHOOKS permission. Returns a 204 No Content response on success.
|
|
175
|
+
* @see https://discord.com/developers/docs/resources/webhook#delete-webhook
|
|
176
|
+
*/
|
|
177
|
+
deleteWebhook(webhook_id: snowflake): Promise<void>
|
|
178
|
+
/**
|
|
179
|
+
* Same as above, except this call does not require authentication.
|
|
180
|
+
* @see https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token
|
|
181
|
+
*/
|
|
182
|
+
deleteWebhookwithToken(webhook_id: snowflake, token: string): Promise<void>
|
|
183
|
+
/**
|
|
184
|
+
* Refer to Uploading Files for details on attachments and multipart/form-data requests.
|
|
185
|
+
* @see https://discord.com/developers/docs/resources/webhook#execute-webhook
|
|
186
|
+
*/
|
|
187
|
+
executeWebhook(webhook_id: snowflake, token: string, body: Webhook.ExecuteBody, query: Webhook.ExecuteParams): Promise<void>
|
|
188
|
+
/**
|
|
189
|
+
* Refer to Slack's documentation for more information. We do not support Slack's channel, icon_emoji, mrkdwn, or mrkdwn_in properties.
|
|
190
|
+
* @see https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook
|
|
191
|
+
*/
|
|
192
|
+
executeSlackCompatibleWebhook(webhook_id: snowflake, token: string, body: null, query: Webhook.ExecuteParams): Promise<void>
|
|
193
|
+
/**
|
|
194
|
+
* Add a new webhook to your GitHub repo (in the repo's settings), and use this endpoint as the "Payload URL." You can choose what events your Discord channel receives by choosing the "Let me select individual events" option and selecting individual events for the new webhook you're configuring.
|
|
195
|
+
* @see https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook
|
|
196
|
+
*/
|
|
197
|
+
executeGitHubCompatibleWebhook(webhook_id: snowflake, token: string, body: null, query: Webhook.ExecuteParams): Promise<void>
|
|
198
|
+
/**
|
|
199
|
+
* Returns a previously-sent webhook message from the same token. Returns a message object on success.
|
|
200
|
+
* @see https://discord.com/developers/docs/resources/webhook#get-webhook-message
|
|
201
|
+
*/
|
|
202
|
+
getWebhookMessage(webhook_id: snowflake, token: string, message_id: snowflake, params: Webhook.MessageParams): Promise<Message>
|
|
203
|
+
/**
|
|
204
|
+
* Edits a previously-sent webhook message from the same token. Returns a message object on success.
|
|
205
|
+
* @see https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
|
206
|
+
*/
|
|
207
|
+
editWebhookMessage(webhook_id: snowflake, token: string, message_id: snowflake, body: Webhook.MessageBody, query: Webhook.MessageParams): Promise<void>
|
|
208
|
+
/**
|
|
209
|
+
* Deletes a message that was created by the webhook. Returns a 204 No Content response on success.
|
|
210
|
+
* @see https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
|
211
|
+
*/
|
|
212
|
+
deleteWebhookMessage(webhook_id: snowflake, token: string, message_id: snowflake, params: Webhook.MessageParams): Promise<void>
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
Internal.define({
|
|
217
|
+
'/channels/{channel.id}/webhooks': {
|
|
218
|
+
POST: 'createWebhook',
|
|
219
|
+
GET: 'getChannelWebhooks',
|
|
220
|
+
},
|
|
221
|
+
'/guilds/{guild.id}/webhooks': {
|
|
222
|
+
GET: 'getGuildWebhooks',
|
|
223
|
+
},
|
|
224
|
+
'/webhooks/{webhook.id}': {
|
|
225
|
+
GET: 'getWebhook',
|
|
226
|
+
PATCH: 'modifyWebhook',
|
|
227
|
+
DELETE: 'deleteWebhook',
|
|
228
|
+
},
|
|
229
|
+
'/webhooks/{webhook.id}/{webhook.token}': {
|
|
230
|
+
GET: 'getWebhookwithToken',
|
|
231
|
+
PATCH: 'modifyWebhookwithToken',
|
|
232
|
+
DELETE: 'deleteWebhookwithToken',
|
|
233
|
+
POST: 'executeWebhook',
|
|
234
|
+
},
|
|
235
|
+
'/webhooks/{webhook.id}/{webhook.token}/slack': {
|
|
236
|
+
POST: 'executeSlackCompatibleWebhook',
|
|
237
|
+
},
|
|
238
|
+
'/webhooks/{webhook.id}/{webhook.token}/github': {
|
|
239
|
+
POST: 'executeGitHubCompatibleWebhook',
|
|
240
|
+
},
|
|
241
|
+
'/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}': {
|
|
242
|
+
GET: 'getWebhookMessage',
|
|
243
|
+
PATCH: 'editWebhookMessage',
|
|
244
|
+
DELETE: 'deleteWebhookMessage',
|
|
245
|
+
},
|
|
246
|
+
})
|