@koishijs/plugin-adapter-discord 2.0.0-rc.0 → 2.0.2
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/bot.d.ts +13 -6
- package/lib/index.d.ts +0 -3
- package/lib/index.js +588 -463
- package/lib/index.js.map +3 -3
- package/lib/sender.d.ts +9 -7
- package/lib/types/application.d.ts +8 -2
- package/lib/types/audit-log.d.ts +111 -95
- package/lib/types/ban.d.ts +67 -0
- package/lib/types/channel.d.ts +223 -102
- package/lib/types/command.d.ts +182 -112
- package/lib/types/emoji.d.ts +26 -107
- package/lib/types/gateway.d.ts +8 -2
- package/lib/types/guild-member.d.ts +178 -72
- package/lib/types/guild-scheduled-event.d.ts +167 -0
- package/lib/types/guild-template.d.ts +62 -0
- package/lib/types/guild.d.ts +195 -43
- package/lib/types/index.d.ts +4 -0
- package/lib/types/integration.d.ts +14 -0
- package/lib/types/interaction.d.ts +59 -2
- package/lib/types/internal.d.ts +3 -3
- package/lib/types/invite.d.ts +127 -77
- package/lib/types/message.d.ts +274 -188
- package/lib/types/reaction.d.ts +114 -0
- package/lib/types/role.d.ts +74 -0
- package/lib/types/scheduled-event.d.ts +167 -0
- package/lib/types/stage-instance.d.ts +54 -8
- package/lib/types/sticker.d.ts +117 -48
- package/lib/types/thread.d.ts +201 -0
- package/lib/types/user.d.ts +28 -11
- package/lib/types/voice.d.ts +35 -1
- package/lib/types/webhook.d.ts +150 -37
- package/lib/utils.d.ts +3 -2
- package/lib/ws.d.ts +3 -6
- package/package.json +9 -7
package/lib/types/guild.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel, Emoji, GuildMember, integer, PresenceUpdateEvent, Role, snowflake, StageInstance, Sticker, timestamp,
|
|
1
|
+
import { Channel, Emoji, GuildMember, integer, PresenceUpdateEvent, Role, snowflake, StageInstance, Sticker, timestamp, VoiceState } from '.';
|
|
2
2
|
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */
|
|
3
3
|
export interface Guild {
|
|
4
4
|
/** guild id */
|
|
@@ -102,6 +102,129 @@ export interface Guild {
|
|
|
102
102
|
/** custom guild stickers */
|
|
103
103
|
stickers?: Sticker[];
|
|
104
104
|
}
|
|
105
|
+
export declare namespace Guild {
|
|
106
|
+
namespace Event {
|
|
107
|
+
interface Create extends Guild {
|
|
108
|
+
}
|
|
109
|
+
interface Update extends Guild {
|
|
110
|
+
}
|
|
111
|
+
interface Delete extends Guild {
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
namespace Params {
|
|
115
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds-query-string-params */
|
|
116
|
+
interface List {
|
|
117
|
+
/** get guilds before this guild ID */
|
|
118
|
+
before: snowflake;
|
|
119
|
+
/** get guilds after this guild ID */
|
|
120
|
+
after: snowflake;
|
|
121
|
+
/** max number of guilds to return (1-200) */
|
|
122
|
+
limit: integer;
|
|
123
|
+
}
|
|
124
|
+
/** https://discord.com/developers/docs/resources/guild#create-guild-json-params */
|
|
125
|
+
interface Create {
|
|
126
|
+
/** name of the guild (2-100 characters) */
|
|
127
|
+
name: string;
|
|
128
|
+
/** voice region id (deprecated) */
|
|
129
|
+
region?: string;
|
|
130
|
+
/** base64 128x128 image for the guild icon */
|
|
131
|
+
icon?: string;
|
|
132
|
+
/** verification level */
|
|
133
|
+
verification_level?: integer;
|
|
134
|
+
/** default message notification level */
|
|
135
|
+
default_message_notifications?: integer;
|
|
136
|
+
/** explicit content filter level */
|
|
137
|
+
explicit_content_filter?: integer;
|
|
138
|
+
/** new guild roles */
|
|
139
|
+
roles?: Role[];
|
|
140
|
+
/** new guild's channels */
|
|
141
|
+
channels?: Partial<Channel>[];
|
|
142
|
+
/** id for afk channel */
|
|
143
|
+
afk_channel_id?: snowflake;
|
|
144
|
+
/** afk timeout in seconds */
|
|
145
|
+
afk_timeout?: integer;
|
|
146
|
+
/** the id of the channel where guild notices such as welcome messages and boost events are posted */
|
|
147
|
+
system_channel_id?: snowflake;
|
|
148
|
+
/** system channel flags */
|
|
149
|
+
system_channel_flags?: integer;
|
|
150
|
+
}
|
|
151
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-query-string-params */
|
|
152
|
+
interface Get {
|
|
153
|
+
/** when true, will return approximate member and presence counts for the guild */
|
|
154
|
+
with_counts?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-json-params */
|
|
157
|
+
interface Modify {
|
|
158
|
+
/** guild name */
|
|
159
|
+
name: string;
|
|
160
|
+
/** guild voice region id (deprecated) */
|
|
161
|
+
region?: string;
|
|
162
|
+
/** verification level */
|
|
163
|
+
verification_level?: integer;
|
|
164
|
+
/** default message notification level */
|
|
165
|
+
default_message_notifications?: integer;
|
|
166
|
+
/** explicit content filter level */
|
|
167
|
+
explicit_content_filter?: integer;
|
|
168
|
+
/** id for afk channel */
|
|
169
|
+
afk_channel_id?: snowflake;
|
|
170
|
+
/** afk timeout in seconds */
|
|
171
|
+
afk_timeout: integer;
|
|
172
|
+
/** base64 1024x1024 png/jpeg/gif image for the guild icon (can be animated gif when the server has the ANIMATED_ICON feature) */
|
|
173
|
+
icon?: string;
|
|
174
|
+
/** user id to transfer guild ownership to (must be owner) */
|
|
175
|
+
owner_id: snowflake;
|
|
176
|
+
/** base64 16:9 png/jpeg image for the guild splash (when the server has the INVITE_SPLASH feature) */
|
|
177
|
+
splash?: string;
|
|
178
|
+
/** base64 16:9 png/jpeg image for the guild discovery splash (when the server has the DISCOVERABLE feature) */
|
|
179
|
+
discovery_splash?: string;
|
|
180
|
+
/** base64 16:9 png/jpeg image for the guild banner (when the server has the BANNER feature) */
|
|
181
|
+
banner?: string;
|
|
182
|
+
/** the id of the channel where guild notices such as welcome messages and boost events are posted */
|
|
183
|
+
system_channel_id?: snowflake;
|
|
184
|
+
/** system channel flags */
|
|
185
|
+
system_channel_flags: integer;
|
|
186
|
+
/** the id of the channel where Community guilds display rules and/or guidelines */
|
|
187
|
+
rules_channel_id?: snowflake;
|
|
188
|
+
/** the id of the channel where admins and moderators of Community guilds receive notices from Discord */
|
|
189
|
+
public_updates_channel_id?: snowflake;
|
|
190
|
+
/** the preferred locale of a Community guild used in server discovery and notices from Discord; defaults to "en-US" */
|
|
191
|
+
preferred_locale?: string;
|
|
192
|
+
/** enabled guild features */
|
|
193
|
+
features: GuildFeature[];
|
|
194
|
+
/** the description for the guild, if the guild is discoverable */
|
|
195
|
+
description?: string;
|
|
196
|
+
/** whether the guild's boost progress bar should be enabled. */
|
|
197
|
+
premium_progress_bar_enabled: boolean;
|
|
198
|
+
}
|
|
199
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */
|
|
200
|
+
interface GetWidgetImage {
|
|
201
|
+
/** style of the widget image returned (see below) */
|
|
202
|
+
style: WidgetStyleOptions;
|
|
203
|
+
}
|
|
204
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-widget-style-options */
|
|
205
|
+
enum WidgetStyleOptions {
|
|
206
|
+
/** shield style widget with Discord icon and guild members online count */
|
|
207
|
+
shield = "shield",
|
|
208
|
+
/** large image with guild icon, name and online count. "POWERED BY DISCORD" as the footer of the widget */
|
|
209
|
+
banner1 = "banner1",
|
|
210
|
+
/** smaller widget style with guild icon, name and online count. Split on the right with Discord logo */
|
|
211
|
+
banner2 = "banner2",
|
|
212
|
+
/** large image with guild icon, name and online count. In the footer, Discord logo on the left and "Chat Now" on the right */
|
|
213
|
+
banner3 = "banner3",
|
|
214
|
+
/** large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom */
|
|
215
|
+
banner4 = "banner4"
|
|
216
|
+
}
|
|
217
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen-json-params */
|
|
218
|
+
interface ModifyWelcomeScreen {
|
|
219
|
+
/** whether the welcome screen is enabled */
|
|
220
|
+
enabled: boolean;
|
|
221
|
+
/** channels linked in the welcome screen and their display options */
|
|
222
|
+
welcome_channels: WelcomeScreenChannel[];
|
|
223
|
+
/** the server description to show in the welcome screen */
|
|
224
|
+
description: string;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
105
228
|
/** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */
|
|
106
229
|
export declare enum SystemChannelFlag {
|
|
107
230
|
/** Suppress member join notifications */
|
|
@@ -188,13 +311,6 @@ export interface GuildWidget {
|
|
|
188
311
|
/** the widget channel id */
|
|
189
312
|
channel_id?: snowflake;
|
|
190
313
|
}
|
|
191
|
-
/** https://discord.com/developers/docs/resources/guild#ban-object-ban-structure */
|
|
192
|
-
export interface Ban {
|
|
193
|
-
/** the reason for the ban */
|
|
194
|
-
reason?: string;
|
|
195
|
-
/** the banned user */
|
|
196
|
-
user: User;
|
|
197
|
-
}
|
|
198
314
|
/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure */
|
|
199
315
|
export interface WelcomeScreen {
|
|
200
316
|
/** the server description shown in the welcome screen */
|
|
@@ -213,55 +329,91 @@ export interface WelcomeScreenChannel {
|
|
|
213
329
|
/** the emoji name if custom, the unicode character if standard, or null if no emoji is set */
|
|
214
330
|
emoji_name?: string;
|
|
215
331
|
}
|
|
216
|
-
export interface GuildCreateEvent extends Guild {
|
|
217
|
-
}
|
|
218
|
-
export interface GuildUpdateEvent extends Guild {
|
|
219
|
-
}
|
|
220
|
-
export interface GuildDeleteEvent extends Guild {
|
|
221
|
-
}
|
|
222
|
-
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add-guild-ban-add-event-fields */
|
|
223
|
-
export interface GuildBanAddEvent {
|
|
224
|
-
/** id of the guild */
|
|
225
|
-
guild_id: snowflake;
|
|
226
|
-
/** the banned user */
|
|
227
|
-
user: User;
|
|
228
|
-
}
|
|
229
|
-
/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove-guild-ban-remove-event-fields */
|
|
230
|
-
export interface GuildBanRemoveEvent {
|
|
231
|
-
/** id of the guild */
|
|
232
|
-
guild_id: snowflake;
|
|
233
|
-
/** the unbanned user */
|
|
234
|
-
user: User;
|
|
235
|
-
}
|
|
236
332
|
declare module './gateway' {
|
|
237
333
|
interface GatewayEvents {
|
|
238
334
|
/** lazy-load for unavailable guild, guild became available, or user joined a new guild */
|
|
239
|
-
GUILD_CREATE:
|
|
335
|
+
GUILD_CREATE: Guild.Event.Create;
|
|
240
336
|
/** guild was updated */
|
|
241
|
-
GUILD_UPDATE:
|
|
337
|
+
GUILD_UPDATE: Guild.Event.Update;
|
|
242
338
|
/** guild became unavailable, or user left/was removed from a guild */
|
|
243
|
-
GUILD_DELETE:
|
|
244
|
-
/** user was banned from a guild */
|
|
245
|
-
GUILD_BAN_ADD: GuildBanAddEvent;
|
|
246
|
-
/** user was unbanned from a guild */
|
|
247
|
-
GUILD_BAN_REMOVE: GuildBanRemoveEvent;
|
|
339
|
+
GUILD_DELETE: Guild.Event.Delete;
|
|
248
340
|
}
|
|
249
341
|
}
|
|
250
342
|
declare module './internal' {
|
|
251
343
|
interface Internal {
|
|
252
|
-
/**
|
|
253
|
-
|
|
254
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Returns a list of partial guild objects the current user is a member of. Requires the guilds OAuth2 scope.
|
|
346
|
+
* @see https://discord.com/developers/docs/resources/user#get-current-user-guilds
|
|
347
|
+
*/
|
|
348
|
+
getCurrentUserGuilds(params?: Guild.Params.List): Promise<Guild[]>;
|
|
349
|
+
/**
|
|
350
|
+
* Returns a guild member object for the current user. Requires the guilds.members.read OAuth2 scope.
|
|
351
|
+
* @see https://discord.com/developers/docs/resources/user#get-current-user-guild-member
|
|
352
|
+
*/
|
|
353
|
+
getCurrentUserGuildMember(guild_id: snowflake): Promise<GuildMember>;
|
|
354
|
+
/**
|
|
355
|
+
* Leave a guild. Returns a 204 empty response on success.
|
|
356
|
+
* @see https://discord.com/developers/docs/resources/user#leave-guild
|
|
357
|
+
*/
|
|
255
358
|
leaveGuild(guild_id: snowflake): Promise<void>;
|
|
256
359
|
}
|
|
257
360
|
}
|
|
258
361
|
declare module './internal' {
|
|
259
362
|
interface Internal {
|
|
260
|
-
/**
|
|
261
|
-
|
|
262
|
-
|
|
363
|
+
/**
|
|
364
|
+
* Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event.
|
|
365
|
+
* @see https://discord.com/developers/docs/resources/guild#create-guild
|
|
366
|
+
*/
|
|
367
|
+
createGuild(params: Guild.Params.Create): Promise<Guild>;
|
|
368
|
+
/**
|
|
369
|
+
* Returns the guild object for the given id. If with_counts is set to true, this endpoint will also return approximate_member_count and approximate_presence_count for the guild.
|
|
370
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild
|
|
371
|
+
*/
|
|
372
|
+
getGuild(guild_id: snowflake, params?: Guild.Params.Get): Promise<Guild>;
|
|
373
|
+
/**
|
|
374
|
+
* Returns the guild preview object for the given id. If the user is not in the guild, then the guild must be lurkable.
|
|
375
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-preview
|
|
376
|
+
*/
|
|
263
377
|
getGuildPreview(guild_id: snowflake): Promise<GuildPreview>;
|
|
264
|
-
/**
|
|
265
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Modify a guild's settings. Requires the MANAGE_GUILD permission. Returns the updated guild object on success. Fires a Guild Update Gateway event.
|
|
380
|
+
* @see https://discord.com/developers/docs/resources/guild#modify-guild
|
|
381
|
+
*/
|
|
382
|
+
modifyGuild(guild_id: snowflake, params: Guild.Params.Modify): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.
|
|
385
|
+
* @see https://discord.com/developers/docs/resources/guild#delete-guild
|
|
386
|
+
*/
|
|
387
|
+
deleteGuild(guild_id: snowflake): Promise<void>;
|
|
388
|
+
/**
|
|
389
|
+
* Returns a guild widget object. Requires the MANAGE_GUILD permission.
|
|
390
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-widget-settings
|
|
391
|
+
*/
|
|
392
|
+
getGuildWidgetSettings(guild_id: snowflake): Promise<GuildWidget>;
|
|
393
|
+
/**
|
|
394
|
+
* Modify a guild widget object for the guild. All attributes may be passed in with JSON and modified. Requires the MANAGE_GUILD permission. Returns the updated guild widget object.
|
|
395
|
+
* @see https://discord.com/developers/docs/resources/guild#modify-guild-widget
|
|
396
|
+
*/
|
|
397
|
+
modifyGuildWidget(guild_id: snowflake, params: Partial<GuildWidget>): Promise<GuildWidget>;
|
|
398
|
+
/**
|
|
399
|
+
* Returns the widget for the guild.
|
|
400
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-widget
|
|
401
|
+
*/
|
|
402
|
+
getGuildWidget(guild_id: snowflake): Promise<any>;
|
|
403
|
+
/**
|
|
404
|
+
* Returns a PNG image widget for the guild. Requires no permissions or authentication.
|
|
405
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-widget-image
|
|
406
|
+
*/
|
|
407
|
+
getGuildWidgetImage(guild_id: snowflake, params?: Guild.Params.GetWidgetImage): Promise<any>;
|
|
408
|
+
/**
|
|
409
|
+
* Returns the Welcome Screen object for the guild.
|
|
410
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
|
|
411
|
+
*/
|
|
412
|
+
getGuildWelcomeScreen(guild_id: snowflake): Promise<WelcomeScreen>;
|
|
413
|
+
/**
|
|
414
|
+
* Modify the guild's Welcome Screen. Requires the MANAGE_GUILD permission. Returns the updated Welcome Screen object.
|
|
415
|
+
* @see https://discord.com/developers/docs/resources/guild#modify-guild-welcome-screen
|
|
416
|
+
*/
|
|
417
|
+
modifyGuildWelcomeScreen(guild_id: snowflake, params: Guild.Params.ModifyWelcomeScreen): Promise<WelcomeScreen>;
|
|
266
418
|
}
|
|
267
419
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './internal';
|
|
2
2
|
export * from './application';
|
|
3
3
|
export * from './audit-log';
|
|
4
|
+
export * from './ban';
|
|
4
5
|
export * from './channel';
|
|
5
6
|
export * from './command';
|
|
6
7
|
export * from './component';
|
|
@@ -15,10 +16,13 @@ export * from './interaction';
|
|
|
15
16
|
export * from './invite';
|
|
16
17
|
export * from './message';
|
|
17
18
|
export * from './presence';
|
|
19
|
+
export * from './reaction';
|
|
18
20
|
export * from './role';
|
|
21
|
+
export * from './scheduled-event';
|
|
19
22
|
export * from './stage-instance';
|
|
20
23
|
export * from './sticker';
|
|
21
24
|
export * from './team';
|
|
25
|
+
export * from './thread';
|
|
22
26
|
export * from './user';
|
|
23
27
|
export * from './voice';
|
|
24
28
|
export * from './webhook';
|
|
@@ -95,3 +95,17 @@ declare module './gateway' {
|
|
|
95
95
|
INTEGRATION_DELETE: IntegrationDeleteEvent;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
declare module './internal' {
|
|
99
|
+
interface Internal {
|
|
100
|
+
/**
|
|
101
|
+
* Returns a list of integration objects for the guild. Requires the MANAGE_GUILD permission.
|
|
102
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-integrations
|
|
103
|
+
*/
|
|
104
|
+
getGuildIntegrations(guild_id: snowflake): Promise<Integration[]>;
|
|
105
|
+
/**
|
|
106
|
+
* Delete the attached integration object for the guild. Deletes any associated webhooks and kicks the associated bot if there is one. Requires the MANAGE_GUILD permission. Returns a 204 empty response on success. Fires a Guild Integrations Update Gateway event.
|
|
107
|
+
* @see https://discord.com/developers/docs/resources/guild#delete-guild-integration
|
|
108
|
+
*/
|
|
109
|
+
deleteGuildIntegration(guild_id: snowflake, integration_id: snowflake): Promise<void>;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AllowedMentions,
|
|
1
|
+
import { AllowedMentions, ApplicationCommand, Channel, Component, Embed, GuildMember, integer, Message, Role, SelectOption, snowflake, User } from '.';
|
|
2
2
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure */
|
|
3
3
|
export interface Interaction {
|
|
4
4
|
/** id of the interaction */
|
|
@@ -30,6 +30,19 @@ export declare enum InteractionType {
|
|
|
30
30
|
APPLICATION_COMMAND = 2,
|
|
31
31
|
MESSAGE_COMPONENT = 3
|
|
32
32
|
}
|
|
33
|
+
/** https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */
|
|
34
|
+
export interface InteractionDataOption {
|
|
35
|
+
/** the name of the parameter */
|
|
36
|
+
name: string;
|
|
37
|
+
/** value of application command option type */
|
|
38
|
+
type: ApplicationCommand.OptionType;
|
|
39
|
+
/** the value of the pair */
|
|
40
|
+
value?: any;
|
|
41
|
+
/** present if this option is a group or subcommand */
|
|
42
|
+
options?: InteractionDataOption[];
|
|
43
|
+
/** true if this option is the currently focused option for autocomplete */
|
|
44
|
+
focused?: boolean;
|
|
45
|
+
}
|
|
33
46
|
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure */
|
|
34
47
|
export interface InteractionData {
|
|
35
48
|
/** the ID of the invoked command */
|
|
@@ -41,7 +54,7 @@ export interface InteractionData {
|
|
|
41
54
|
/** converted users + roles + channels */
|
|
42
55
|
resolved?: ResolvedData;
|
|
43
56
|
/** the params + values from the user */
|
|
44
|
-
options?:
|
|
57
|
+
options?: InteractionDataOption[];
|
|
45
58
|
/** the custom_id of the component */
|
|
46
59
|
custom_id?: string;
|
|
47
60
|
/** the type of the component */
|
|
@@ -123,3 +136,47 @@ declare module './gateway' {
|
|
|
123
136
|
INTERACTION_CREATE: InteractionCreateEvent;
|
|
124
137
|
}
|
|
125
138
|
}
|
|
139
|
+
declare module './internal' {
|
|
140
|
+
interface Internal {
|
|
141
|
+
/**
|
|
142
|
+
* Create a response to an Interaction from the gateway. Takes an interaction response. This endpoint also supports file attachments similar to the webhook endpoints. Refer to Uploading Files for details on uploading files and multipart/form-data requests.
|
|
143
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#create-interaction-response
|
|
144
|
+
*/
|
|
145
|
+
createInteractionResponse(interaction_id: snowflake, token: string, params: InteractionResponse): Promise<void>;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the initial Interaction response. Functions the same as Get Webhook Message.
|
|
148
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#get-original-interaction-response
|
|
149
|
+
*/
|
|
150
|
+
getOriginalInteractionResponse(application_id: snowflake, token: string): Promise<InteractionResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Edits the initial Interaction response. Functions the same as Edit Webhook Message.
|
|
153
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
|
|
154
|
+
*/
|
|
155
|
+
editOriginalInteractionResponse(application_id: snowflake, token: string): Promise<InteractionResponse>;
|
|
156
|
+
/**
|
|
157
|
+
* Deletes the initial Interaction response. Returns 204 No Content on success.
|
|
158
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
|
|
159
|
+
*/
|
|
160
|
+
deleteOriginalInteractionResponse(application_id: snowflake, token: string): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Create a followup message for an Interaction. Functions the same as Execute Webhook, but wait is always true, and flags can be set to 64 in the body to send an ephemeral message. The thread_id, avatar_url, and username parameters are not supported when using this endpoint for interaction followups.
|
|
163
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#create-followup-message
|
|
164
|
+
*/
|
|
165
|
+
createFollowupMessage(application_id: snowflake, token: string): Promise<any>;
|
|
166
|
+
/**
|
|
167
|
+
* Returns a followup message for an Interaction. Functions the same as Get Webhook Message. Does not support ephemeral followups.
|
|
168
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#get-followup-message
|
|
169
|
+
*/
|
|
170
|
+
getFollowupMessage(application_id: snowflake, token: string, message_id: snowflake): Promise<any>;
|
|
171
|
+
/**
|
|
172
|
+
* Edits a followup message for an Interaction. Functions the same as Edit Webhook Message. Does not support ephemeral followups.
|
|
173
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
|
|
174
|
+
*/
|
|
175
|
+
editFollowupMessage(application_id: snowflake, token: string, message_id: snowflake): Promise<any>;
|
|
176
|
+
/**
|
|
177
|
+
* Deletes a followup message for an Interaction. Returns 204 No Content on success. Does not support ephemeral followups.
|
|
178
|
+
* @see https://discord.com/developers/docs/interactions/receiving-and-responding#delete-followup-message
|
|
179
|
+
*/
|
|
180
|
+
deleteFollowupMessage(application_id: snowflake, token: string, message_id: snowflake): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
}
|
package/lib/types/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Quester } from 'koishi';
|
|
2
|
-
declare type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
|
|
1
|
+
import { Dict, Quester } from 'koishi';
|
|
2
|
+
declare type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
3
3
|
export declare class Internal {
|
|
4
4
|
private http;
|
|
5
|
-
static define(routes:
|
|
5
|
+
static define(routes: Dict<Partial<Record<Method, string | string[]>>>): void;
|
|
6
6
|
constructor(http: Quester);
|
|
7
7
|
}
|
|
8
8
|
export {};
|
package/lib/types/invite.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface Invite {
|
|
|
10
10
|
/** the user who created the invite */
|
|
11
11
|
inviter?: User;
|
|
12
12
|
/** the type of target for this voice channel invite */
|
|
13
|
-
target_type?:
|
|
13
|
+
target_type?: Invite.TargetType;
|
|
14
14
|
/** the user whose stream to display for this voice channel stream invite */
|
|
15
15
|
target_user?: User;
|
|
16
16
|
/** the embedded application to open for this voice channel embedded application invite */
|
|
@@ -22,92 +22,142 @@ export interface Invite {
|
|
|
22
22
|
/** the expiration date of this invite, returned from the GET /invites/<code> endpoint when with_expiration is true */
|
|
23
23
|
expires_at?: timestamp;
|
|
24
24
|
/** stage instance data if there is a public Stage instance in the Stage channel this invite is for */
|
|
25
|
-
stage_instance?:
|
|
25
|
+
stage_instance?: Invite.StageInstance;
|
|
26
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
27
|
+
export declare namespace Invite {
|
|
28
|
+
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types */
|
|
29
|
+
enum TargetType {
|
|
30
|
+
STREAM = 1,
|
|
31
|
+
EMBEDDED_APPLICATION = 2
|
|
32
|
+
}
|
|
33
|
+
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
34
|
+
interface Metadata extends Invite {
|
|
35
|
+
/** number of times this invite has been used */
|
|
36
|
+
uses: integer;
|
|
37
|
+
/** max number of times this invite can be used */
|
|
38
|
+
max_uses: integer;
|
|
39
|
+
/** duration (in seconds) after which the invite expires */
|
|
40
|
+
max_age: integer;
|
|
41
|
+
/** whether this invite only grants temporary membership */
|
|
42
|
+
temporary: boolean;
|
|
43
|
+
/** when this invite was created */
|
|
44
|
+
created_at: timestamp;
|
|
45
|
+
}
|
|
46
|
+
/** https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure */
|
|
47
|
+
interface StageInstance {
|
|
48
|
+
/** the members speaking in the Stage */
|
|
49
|
+
members: Partial<GuildMember>[];
|
|
50
|
+
/** the number of users in the Stage */
|
|
51
|
+
participant_count: integer;
|
|
52
|
+
/** the number of users speaking in the Stage */
|
|
53
|
+
speaker_count: integer;
|
|
54
|
+
/** the topic of the Stage instance (1-120 characters) */
|
|
55
|
+
topic: string;
|
|
56
|
+
}
|
|
57
|
+
namespace Event {
|
|
58
|
+
/** https://discord.com/developers/docs/topics/gateway#invite-create-invite-create-event-fields */
|
|
59
|
+
interface Create {
|
|
60
|
+
/** the channel the invite is for */
|
|
61
|
+
channel_id: snowflake;
|
|
62
|
+
/** the unique invite code */
|
|
63
|
+
code: string;
|
|
64
|
+
/** the time at which the invite was created */
|
|
65
|
+
created_at: timestamp;
|
|
66
|
+
/** the guild of the invite */
|
|
67
|
+
guild_id?: snowflake;
|
|
68
|
+
/** the user that created the invite */
|
|
69
|
+
inviter?: User;
|
|
70
|
+
/** how long the invite is valid for (in seconds) */
|
|
71
|
+
max_age: integer;
|
|
72
|
+
/** the maximum number of times the invite can be used */
|
|
73
|
+
max_uses: integer;
|
|
74
|
+
/** the type of target for this voice channel invite */
|
|
75
|
+
target_type?: integer;
|
|
76
|
+
/** the user whose stream to display for this voice channel stream invite */
|
|
77
|
+
target_user?: User;
|
|
78
|
+
/** the embedded application to open for this voice channel embedded application invite */
|
|
79
|
+
target_application?: Partial<Application>;
|
|
80
|
+
/** whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) */
|
|
81
|
+
temporary: boolean;
|
|
82
|
+
/** how many times the invite has been used (always will be 0) */
|
|
83
|
+
uses: integer;
|
|
84
|
+
}
|
|
85
|
+
/** https://discord.com/developers/docs/topics/gateway#invite-delete-invite-delete-event-fields */
|
|
86
|
+
interface Delete {
|
|
87
|
+
/** the channel of the invite */
|
|
88
|
+
channel_id: snowflake;
|
|
89
|
+
/** the guild of the invite */
|
|
90
|
+
guild_id?: snowflake;
|
|
91
|
+
/** the unique invite code */
|
|
92
|
+
code: string;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** https://discord.com/developers/docs/resources/invite#get-invite-query-string-params */
|
|
96
|
+
interface GetOptions {
|
|
97
|
+
/** whether to include invite metadata */
|
|
98
|
+
with_counts?: boolean;
|
|
99
|
+
/** whether to include invite expiration date */
|
|
100
|
+
with_expiration?: boolean;
|
|
101
|
+
/** the guild scheduled event to include with the invite */
|
|
102
|
+
guild_scheduled_event_id?: snowflake;
|
|
103
|
+
}
|
|
104
|
+
/** https://discord.com/developers/docs/resources/channel#create-channel-invite-json-params */
|
|
105
|
+
interface CreateParams {
|
|
106
|
+
/** duration of invite in seconds before expiry, or 0 for never. between 0 and 604800 (7 days) */
|
|
107
|
+
max_age: integer;
|
|
108
|
+
/** max number of uses or 0 for unlimited. between 0 and 100 */
|
|
109
|
+
max_uses: integer;
|
|
110
|
+
/** whether this invite only grants temporary membership */
|
|
111
|
+
temporary: boolean;
|
|
112
|
+
/** if true, don't try to reuse a similar invite (useful for creating many unique one time use invites) */
|
|
113
|
+
unique: boolean;
|
|
114
|
+
/** the type of target for this voice channel invite */
|
|
115
|
+
target_type: integer;
|
|
116
|
+
/** the id of the user whose stream to display for this invite, required if target_type is 1, the user must be streaming in the channel */
|
|
117
|
+
target_user_id: snowflake;
|
|
118
|
+
/** the id of the embedded application to open for this invite, required if target_type is 2, the application must have the EMBEDDED flag */
|
|
119
|
+
target_application_id: snowflake;
|
|
120
|
+
}
|
|
91
121
|
}
|
|
92
122
|
declare module './gateway' {
|
|
93
123
|
interface GatewayEvents {
|
|
94
124
|
/** invite to a channel was created */
|
|
95
|
-
INVITE_CREATE:
|
|
125
|
+
INVITE_CREATE: Invite.Event.Create;
|
|
96
126
|
/** invite to a channel was deleted */
|
|
97
|
-
INVITE_DELETE:
|
|
127
|
+
INVITE_DELETE: Invite.Event.Delete;
|
|
98
128
|
}
|
|
99
129
|
}
|
|
100
|
-
export interface GetInviteOptions {
|
|
101
|
-
/** whether to include invite metadata */
|
|
102
|
-
with_counts?: boolean;
|
|
103
|
-
/** whether to include invite expiration date */
|
|
104
|
-
with_expiration?: boolean;
|
|
105
|
-
}
|
|
106
130
|
declare module './internal' {
|
|
107
131
|
interface Internal {
|
|
108
|
-
/**
|
|
109
|
-
|
|
110
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Returns an invite object for the given code.
|
|
134
|
+
* @see https://discord.com/developers/docs/resources/invite#get-invite
|
|
135
|
+
*/
|
|
136
|
+
getInvite(code: string, params?: Invite.GetOptions): Promise<Invite>;
|
|
137
|
+
/**
|
|
138
|
+
* Delete an invite. Requires the MANAGE_CHANNELS permission on the channel this invite belongs to, or MANAGE_GUILD to remove any invite across the guild. Returns an invite object on success. Fires a Invite Delete Gateway event.
|
|
139
|
+
* @see https://discord.com/developers/docs/resources/invite#delete-invite
|
|
140
|
+
*/
|
|
111
141
|
deleteInvite(code: string): Promise<Invite>;
|
|
142
|
+
/**
|
|
143
|
+
* Returns a list of invite objects (with invite metadata) for the guild. Requires the MANAGE_GUILD permission.
|
|
144
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-invites
|
|
145
|
+
*/
|
|
146
|
+
getGuildInvites(guild_id: snowflake): Promise<Invite.Metadata[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Returns a partial invite object for guilds with that feature enabled. Requires the MANAGE_GUILD permission. code will be null if a vanity url for the guild is not set.
|
|
149
|
+
* @see https://discord.com/developers/docs/resources/guild#get-guild-vanity-url
|
|
150
|
+
*/
|
|
151
|
+
getGuildVanityURL(guild_id: snowflake): Promise<Partial<Invite>>;
|
|
152
|
+
/**
|
|
153
|
+
* Returns a list of invite objects (with invite metadata) for the channel. Only usable for guild channels. Requires the MANAGE_CHANNELS permission.
|
|
154
|
+
* @see https://discord.com/developers/docs/resources/channel#get-channel-invites
|
|
155
|
+
*/
|
|
156
|
+
getChannelInvites(channel_id: string): Promise<Invite.Metadata[]>;
|
|
157
|
+
/**
|
|
158
|
+
* Create a new invite object for the channel. Only usable for guild channels. Requires the CREATE_INSTANT_INVITE permission. All JSON parameters for this route are optional, however the request body is not. If you are not sending any fields, you still have to send an empty JSON object ({}). Returns an invite object. Fires an Invite Create Gateway event.
|
|
159
|
+
* @see https://discord.com/developers/docs/resources/channel#create-channel-invite
|
|
160
|
+
*/
|
|
161
|
+
createChannelInvite(channel_id: string, params: Invite.CreateParams): Promise<void>;
|
|
112
162
|
}
|
|
113
163
|
}
|