@koishijs/plugin-adapter-discord 2.1.2 → 3.1.0
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.d.ts +3 -14
- package/lib/index.js +21 -1544
- package/lib/index.js.map +4 -4
- package/package.json +10 -22
- package/lib/bot.d.ts +0 -64
- package/lib/sender.d.ts +0 -36
- package/lib/types/application.d.ts +0 -84
- package/lib/types/audit-log.d.ts +0 -128
- package/lib/types/ban.d.ts +0 -67
- package/lib/types/channel.d.ts +0 -368
- package/lib/types/command.d.ts +0 -214
- package/lib/types/component.d.ts +0 -84
- package/lib/types/device.d.ts +0 -41
- package/lib/types/emoji.d.ts +0 -63
- package/lib/types/gateway.d.ts +0 -248
- package/lib/types/guild-member.d.ts +0 -216
- package/lib/types/guild-scheduled-event.d.ts +0 -167
- package/lib/types/guild-template.d.ts +0 -88
- package/lib/types/guild.d.ts +0 -419
- package/lib/types/index.d.ts +0 -31
- package/lib/types/integration.d.ts +0 -111
- package/lib/types/interaction.d.ts +0 -182
- package/lib/types/internal.d.ts +0 -8
- package/lib/types/invite.d.ts +0 -163
- package/lib/types/message.d.ts +0 -404
- package/lib/types/presence.d.ts +0 -151
- package/lib/types/reaction.d.ts +0 -114
- package/lib/types/role.d.ts +0 -221
- package/lib/types/scheduled-event.d.ts +0 -167
- package/lib/types/stage-instance.d.ts +0 -78
- package/lib/types/sticker.d.ts +0 -149
- package/lib/types/team.d.ts +0 -30
- package/lib/types/thread.d.ts +0 -201
- package/lib/types/user.d.ts +0 -122
- package/lib/types/voice.d.ts +0 -102
- package/lib/types/webhook.d.ts +0 -199
- package/lib/types.d.ts +0 -354
- package/lib/utils.d.ts +0 -15
- package/lib/ws.d.ts +0 -26
package/lib/types/index.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export * from './internal';
|
|
2
|
-
export * from './application';
|
|
3
|
-
export * from './audit-log';
|
|
4
|
-
export * from './ban';
|
|
5
|
-
export * from './channel';
|
|
6
|
-
export * from './command';
|
|
7
|
-
export * from './component';
|
|
8
|
-
export * from './device';
|
|
9
|
-
export * from './emoji';
|
|
10
|
-
export * from './gateway';
|
|
11
|
-
export * from './guild-member';
|
|
12
|
-
export * from './guild-template';
|
|
13
|
-
export * from './guild';
|
|
14
|
-
export * from './integration';
|
|
15
|
-
export * from './interaction';
|
|
16
|
-
export * from './invite';
|
|
17
|
-
export * from './message';
|
|
18
|
-
export * from './presence';
|
|
19
|
-
export * from './reaction';
|
|
20
|
-
export * from './role';
|
|
21
|
-
export * from './scheduled-event';
|
|
22
|
-
export * from './stage-instance';
|
|
23
|
-
export * from './sticker';
|
|
24
|
-
export * from './team';
|
|
25
|
-
export * from './thread';
|
|
26
|
-
export * from './user';
|
|
27
|
-
export * from './voice';
|
|
28
|
-
export * from './webhook';
|
|
29
|
-
export declare type integer = number;
|
|
30
|
-
export declare type snowflake = string;
|
|
31
|
-
export declare type timestamp = string;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { integer, snowflake, timestamp, User } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-structure */
|
|
3
|
-
export interface Integration {
|
|
4
|
-
/** integration id */
|
|
5
|
-
id: snowflake;
|
|
6
|
-
/** integration name */
|
|
7
|
-
name: string;
|
|
8
|
-
/** integration type (twitch, youtube, or discord) */
|
|
9
|
-
type: string;
|
|
10
|
-
/** is this integration enabled */
|
|
11
|
-
enabled: boolean;
|
|
12
|
-
/** is this integration syncing */
|
|
13
|
-
syncing?: boolean;
|
|
14
|
-
/** id that this integration uses for "subscribers" */
|
|
15
|
-
role_id?: snowflake;
|
|
16
|
-
/** whether emoticons should be synced for this integration (twitch only currently) */
|
|
17
|
-
enable_emoticons?: boolean;
|
|
18
|
-
/** the behavior of expiring subscribers */
|
|
19
|
-
expire_behavior?: IntegrationExpireBehavior;
|
|
20
|
-
/** the grace period (in days) before expiring subscribers */
|
|
21
|
-
expire_grace_period?: integer;
|
|
22
|
-
/** user for this integration */
|
|
23
|
-
user?: User;
|
|
24
|
-
/** integration account information */
|
|
25
|
-
account: IntegrationAccount;
|
|
26
|
-
/** when this integration was last synced */
|
|
27
|
-
synced_at?: timestamp;
|
|
28
|
-
/** how many subscribers this integration has */
|
|
29
|
-
subscriber_count?: integer;
|
|
30
|
-
/** has this integration been revoked */
|
|
31
|
-
revoked?: boolean;
|
|
32
|
-
/** The bot/OAuth2 application for discord integrations */
|
|
33
|
-
application?: IntegrationApplication;
|
|
34
|
-
}
|
|
35
|
-
/** https://discord.com/developers/docs/resources/guild#integration-object-integration-expire-behaviors */
|
|
36
|
-
export declare enum IntegrationExpireBehavior {
|
|
37
|
-
REMOVE_ROLE = 0,
|
|
38
|
-
KICK = 1
|
|
39
|
-
}
|
|
40
|
-
/** https://discord.com/developers/docs/resources/guild#integration-account-object-integration-account-structure */
|
|
41
|
-
export interface IntegrationAccount {
|
|
42
|
-
/** id of the account */
|
|
43
|
-
id: string;
|
|
44
|
-
/** name of the account */
|
|
45
|
-
name: string;
|
|
46
|
-
}
|
|
47
|
-
/** https://discord.com/developers/docs/resources/guild#integration-application-object-integration-application-structure */
|
|
48
|
-
export interface IntegrationApplication {
|
|
49
|
-
/** the id of the app */
|
|
50
|
-
id: snowflake;
|
|
51
|
-
/** the name of the app */
|
|
52
|
-
name: string;
|
|
53
|
-
/** the icon hash of the app */
|
|
54
|
-
icon?: string;
|
|
55
|
-
/** the description of the app */
|
|
56
|
-
description: string;
|
|
57
|
-
/** the summary of the app */
|
|
58
|
-
summary: string;
|
|
59
|
-
/** the bot associated with this application */
|
|
60
|
-
bot?: User;
|
|
61
|
-
}
|
|
62
|
-
/** https://discord.com/developers/docs/topics/gateway#guild-integrations-update-guild-integrations-update-event-fields */
|
|
63
|
-
export interface GuildIntegrationsUpdateEvent {
|
|
64
|
-
/** id of the guild whose integrations were updated */
|
|
65
|
-
guild_id: snowflake;
|
|
66
|
-
}
|
|
67
|
-
/** https://discord.com/developers/docs/topics/gateway#integration-create-integration-create-event-additional-fields */
|
|
68
|
-
export interface IntegrationCreateEvent extends Integration {
|
|
69
|
-
/** id of the guild */
|
|
70
|
-
guild_id: snowflake;
|
|
71
|
-
}
|
|
72
|
-
/** https://discord.com/developers/docs/topics/gateway#integration-update-integration-update-event-additional-fields */
|
|
73
|
-
export interface IntegrationUpdateEvent extends Integration {
|
|
74
|
-
/** id of the guild */
|
|
75
|
-
guild_id: snowflake;
|
|
76
|
-
}
|
|
77
|
-
/** https://discord.com/developers/docs/topics/gateway#integration-delete-integration-delete-event-fields */
|
|
78
|
-
export interface IntegrationDeleteEvent {
|
|
79
|
-
/** integration id */
|
|
80
|
-
id: snowflake;
|
|
81
|
-
/** id of the guild */
|
|
82
|
-
guild_id: snowflake;
|
|
83
|
-
/** id of the bot/OAuth2 application for this discord integration */
|
|
84
|
-
application_id?: snowflake;
|
|
85
|
-
}
|
|
86
|
-
declare module './gateway' {
|
|
87
|
-
interface GatewayEvents {
|
|
88
|
-
/** guild integration was updated */
|
|
89
|
-
GUILD_INTEGRATIONS_UPDATE: GuildIntegrationsUpdateEvent;
|
|
90
|
-
/** guild integration was created */
|
|
91
|
-
INTEGRATION_CREATE: IntegrationCreateEvent;
|
|
92
|
-
/** guild integration was updated */
|
|
93
|
-
INTEGRATION_UPDATE: IntegrationUpdateEvent;
|
|
94
|
-
/** guild integration was deleted */
|
|
95
|
-
INTEGRATION_DELETE: IntegrationDeleteEvent;
|
|
96
|
-
}
|
|
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,182 +0,0 @@
|
|
|
1
|
-
import { AllowedMentions, ApplicationCommand, Channel, Component, Embed, GuildMember, integer, Message, Role, SelectOption, snowflake, User } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-structure */
|
|
3
|
-
export interface Interaction {
|
|
4
|
-
/** id of the interaction */
|
|
5
|
-
id: snowflake;
|
|
6
|
-
/** id of the application this interaction is for */
|
|
7
|
-
application_id: snowflake;
|
|
8
|
-
/** the type of interaction */
|
|
9
|
-
type: InteractionType;
|
|
10
|
-
/** the command data payload */
|
|
11
|
-
data?: InteractionData;
|
|
12
|
-
/** the guild it was sent from */
|
|
13
|
-
guild_id?: snowflake;
|
|
14
|
-
/** the channel it was sent from */
|
|
15
|
-
channel_id?: snowflake;
|
|
16
|
-
/** guild member data for the invoking user, including permissions */
|
|
17
|
-
member?: GuildMember;
|
|
18
|
-
/** user object for the invoking user, if invoked in a DM */
|
|
19
|
-
user?: User;
|
|
20
|
-
/** a continuation token for responding to the interaction */
|
|
21
|
-
token: string;
|
|
22
|
-
/** read-only property, always 1 */
|
|
23
|
-
version: integer;
|
|
24
|
-
/** for components, the message they were attached to */
|
|
25
|
-
message?: Message;
|
|
26
|
-
}
|
|
27
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-type */
|
|
28
|
-
export declare enum InteractionType {
|
|
29
|
-
PING = 1,
|
|
30
|
-
APPLICATION_COMMAND = 2,
|
|
31
|
-
MESSAGE_COMPONENT = 3
|
|
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
|
-
}
|
|
46
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure */
|
|
47
|
-
export interface InteractionData {
|
|
48
|
-
/** the ID of the invoked command */
|
|
49
|
-
id: snowflake;
|
|
50
|
-
/** the name of the invoked command */
|
|
51
|
-
name: string;
|
|
52
|
-
/** the type of the invoked command */
|
|
53
|
-
type: integer;
|
|
54
|
-
/** converted users + roles + channels */
|
|
55
|
-
resolved?: ResolvedData;
|
|
56
|
-
/** the params + values from the user */
|
|
57
|
-
options?: InteractionDataOption[];
|
|
58
|
-
/** the custom_id of the component */
|
|
59
|
-
custom_id?: string;
|
|
60
|
-
/** the type of the component */
|
|
61
|
-
component_type?: integer;
|
|
62
|
-
/** the values the user selected */
|
|
63
|
-
values?: SelectOption[];
|
|
64
|
-
/** id the of user or message targetted by a user or message command */
|
|
65
|
-
target_id?: snowflake;
|
|
66
|
-
}
|
|
67
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure */
|
|
68
|
-
export interface ResolvedData {
|
|
69
|
-
/** the ids and User objects */
|
|
70
|
-
users?: Record<snowflake, User>;
|
|
71
|
-
/** the ids and partial Member objects */
|
|
72
|
-
members?: Record<snowflake, Partial<GuildMember>>;
|
|
73
|
-
/** the ids and Role objects */
|
|
74
|
-
roles?: Record<snowflake, Role>;
|
|
75
|
-
/** the ids and partial Channel objects */
|
|
76
|
-
channels?: Record<snowflake, Partial<Channel>>;
|
|
77
|
-
/** the ids and partial Message objects */
|
|
78
|
-
messages?: Record<snowflake, Partial<Message>>;
|
|
79
|
-
}
|
|
80
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure */
|
|
81
|
-
export interface MessageInteraction {
|
|
82
|
-
/** id of the interaction */
|
|
83
|
-
id: snowflake;
|
|
84
|
-
/** the type of interaction */
|
|
85
|
-
type: InteractionType;
|
|
86
|
-
/** the name of the application command */
|
|
87
|
-
name: string;
|
|
88
|
-
/** the user who invoked the interaction */
|
|
89
|
-
user: User;
|
|
90
|
-
}
|
|
91
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-response-structure */
|
|
92
|
-
export interface InteractionResponse {
|
|
93
|
-
/** the type of response */
|
|
94
|
-
type: InteractionCallbackType;
|
|
95
|
-
/** an optional response message */
|
|
96
|
-
data?: InteractionCallbackData;
|
|
97
|
-
}
|
|
98
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type */
|
|
99
|
-
export declare enum InteractionCallbackType {
|
|
100
|
-
/** ACK a Ping */
|
|
101
|
-
PONG = 1,
|
|
102
|
-
/** respond to an interaction with a message */
|
|
103
|
-
CHANNEL_MESSAGE_WITH_SOURCE = 4,
|
|
104
|
-
/** ACK an interaction and edit a response later, the user sees a loading state */
|
|
105
|
-
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
|
|
106
|
-
/** for components, ACK an interaction and edit the original message later; the user does not see a loading state */
|
|
107
|
-
DEFERRED_UPDATE_MESSAGE = 6,
|
|
108
|
-
/** for components, edit the message the component was attached to */
|
|
109
|
-
UPDATE_MESSAGE = 7
|
|
110
|
-
}
|
|
111
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure */
|
|
112
|
-
export interface InteractionCallbackData {
|
|
113
|
-
/** is the response TTS */
|
|
114
|
-
tts?: boolean;
|
|
115
|
-
/** message content */
|
|
116
|
-
content?: string;
|
|
117
|
-
/** supports up to 10 embeds */
|
|
118
|
-
embeds?: Embed[];
|
|
119
|
-
/** allowed mentions object */
|
|
120
|
-
allowed_mentions?: AllowedMentions;
|
|
121
|
-
/** interaction callback data flags */
|
|
122
|
-
flags?: integer;
|
|
123
|
-
/** message components */
|
|
124
|
-
components?: Component[];
|
|
125
|
-
}
|
|
126
|
-
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-flags */
|
|
127
|
-
export declare enum InteractionCallbackDataFlag {
|
|
128
|
-
/** only the user receiving the message can see it */
|
|
129
|
-
EPHEMERAL = 64
|
|
130
|
-
}
|
|
131
|
-
export interface InteractionCreateEvent extends Interaction {
|
|
132
|
-
}
|
|
133
|
-
declare module './gateway' {
|
|
134
|
-
interface GatewayEvents {
|
|
135
|
-
/** user used an interaction, such as an Application Command */
|
|
136
|
-
INTERACTION_CREATE: InteractionCreateEvent;
|
|
137
|
-
}
|
|
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
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Dict, Quester } from 'koishi';
|
|
2
|
-
declare type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
3
|
-
export declare class Internal {
|
|
4
|
-
private http;
|
|
5
|
-
constructor(http: Quester);
|
|
6
|
-
static define(routes: Dict<Partial<Record<Method, string | string[]>>>): void;
|
|
7
|
-
}
|
|
8
|
-
export {};
|
package/lib/types/invite.d.ts
DELETED
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { Application, Channel, Guild, GuildMember, integer, snowflake, timestamp, User } from '.';
|
|
2
|
-
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-structure */
|
|
3
|
-
export interface Invite {
|
|
4
|
-
/** the invite code (unique ID) */
|
|
5
|
-
code: string;
|
|
6
|
-
/** the guild this invite is for */
|
|
7
|
-
guild?: Partial<Guild>;
|
|
8
|
-
/** the channel this invite is for */
|
|
9
|
-
channel: Partial<Channel>;
|
|
10
|
-
/** the user who created the invite */
|
|
11
|
-
inviter?: User;
|
|
12
|
-
/** the type of target for this voice channel invite */
|
|
13
|
-
target_type?: Invite.TargetType;
|
|
14
|
-
/** the user whose stream to display for this voice channel stream invite */
|
|
15
|
-
target_user?: User;
|
|
16
|
-
/** the embedded application to open for this voice channel embedded application invite */
|
|
17
|
-
target_application?: Partial<Application>;
|
|
18
|
-
/** approximate count of online members, returned from the GET /invites/<code> endpoint when with_counts is true */
|
|
19
|
-
approximate_presence_count?: integer;
|
|
20
|
-
/** approximate count of total members, returned from the GET /invites/<code> endpoint when with_counts is true */
|
|
21
|
-
approximate_member_count?: integer;
|
|
22
|
-
/** the expiration date of this invite, returned from the GET /invites/<code> endpoint when with_expiration is true */
|
|
23
|
-
expires_at?: timestamp;
|
|
24
|
-
/** stage instance data if there is a public Stage instance in the Stage channel this invite is for */
|
|
25
|
-
stage_instance?: Invite.StageInstance;
|
|
26
|
-
}
|
|
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
|
-
}
|
|
121
|
-
}
|
|
122
|
-
declare module './gateway' {
|
|
123
|
-
interface GatewayEvents {
|
|
124
|
-
/** invite to a channel was created */
|
|
125
|
-
INVITE_CREATE: Invite.Event.Create;
|
|
126
|
-
/** invite to a channel was deleted */
|
|
127
|
-
INVITE_DELETE: Invite.Event.Delete;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
declare module './internal' {
|
|
131
|
-
interface Internal {
|
|
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
|
-
*/
|
|
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>;
|
|
162
|
-
}
|
|
163
|
-
}
|