@koishijs/plugin-adapter-discord 2.0.0-alpha.7 → 2.0.0-beta.3
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 +8 -40
- package/lib/index.d.ts +11 -2
- package/lib/index.js +911 -143
- package/lib/index.js.map +3 -3
- package/lib/types/application.d.ts +78 -0
- package/lib/types/audit-log.d.ts +112 -0
- package/lib/types/channel.d.ts +247 -0
- package/lib/types/command.d.ts +144 -0
- package/lib/types/component.d.ts +84 -0
- package/lib/types/device.d.ts +41 -0
- package/lib/types/emoji.d.ts +144 -0
- package/lib/types/gateway.d.ts +242 -0
- package/lib/types/guild-member.d.ts +110 -0
- package/lib/types/guild-template.d.ts +26 -0
- package/lib/types/guild.d.ts +267 -0
- package/lib/types/index.d.ts +27 -0
- package/lib/types/integration.d.ts +97 -0
- package/lib/types/interaction.d.ts +125 -0
- package/lib/types/internal.d.ts +8 -0
- package/lib/types/invite.d.ts +113 -0
- package/lib/types/message.d.ts +318 -0
- package/lib/types/presence.d.ts +151 -0
- package/lib/types/role.d.ts +147 -0
- package/lib/types/stage-instance.d.ts +32 -0
- package/lib/types/sticker.d.ts +80 -0
- package/lib/types/team.d.ts +30 -0
- package/lib/types/user.d.ts +105 -0
- package/lib/types/voice.d.ts +68 -0
- package/lib/types/webhook.d.ts +86 -0
- package/lib/utils.d.ts +3 -3
- package/lib/ws.d.ts +3 -4
- package/package.json +4 -4
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { Channel, Emoji, GuildMember, integer, PresenceUpdateEvent, Role, snowflake, StageInstance, Sticker, timestamp, User, VoiceState } from '.';
|
|
2
|
+
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-structure */
|
|
3
|
+
export interface Guild {
|
|
4
|
+
/** guild id */
|
|
5
|
+
id: snowflake;
|
|
6
|
+
/** guild name (2-100 characters, excluding trailing and leading whitespace) */
|
|
7
|
+
name: string;
|
|
8
|
+
/** icon hash */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** icon hash, returned when in the template object */
|
|
11
|
+
icon_hash?: string;
|
|
12
|
+
/** splash hash */
|
|
13
|
+
splash?: string;
|
|
14
|
+
/** discovery splash hash; only present for guilds with the "DISCOVERABLE" feature */
|
|
15
|
+
discovery_splash?: string;
|
|
16
|
+
/** true if the user is the owner of the guild */
|
|
17
|
+
owner?: boolean;
|
|
18
|
+
/** id of owner */
|
|
19
|
+
owner_id: snowflake;
|
|
20
|
+
/** total permissions for the user in the guild (excludes overwrites) */
|
|
21
|
+
permissions?: string;
|
|
22
|
+
/** voice region id for the guild (deprecated) */
|
|
23
|
+
region?: string;
|
|
24
|
+
/** id of afk channel */
|
|
25
|
+
afk_channel_id?: snowflake;
|
|
26
|
+
/** afk timeout in seconds */
|
|
27
|
+
afk_timeout: integer;
|
|
28
|
+
/** true if the server widget is enabled */
|
|
29
|
+
widget_enabled?: boolean;
|
|
30
|
+
/** the channel id that the widget will generate an invite to, or null if set to no invite */
|
|
31
|
+
widget_channel_id?: snowflake;
|
|
32
|
+
/** verification level required for the guild */
|
|
33
|
+
verification_level: integer;
|
|
34
|
+
/** default message notifications level */
|
|
35
|
+
default_message_notifications: integer;
|
|
36
|
+
/** explicit content filter level */
|
|
37
|
+
explicit_content_filter: integer;
|
|
38
|
+
/** roles in the guild */
|
|
39
|
+
roles: Role[];
|
|
40
|
+
/** custom guild emojis */
|
|
41
|
+
emojis: Emoji[];
|
|
42
|
+
/** enabled guild features */
|
|
43
|
+
features: GuildFeature[];
|
|
44
|
+
/** required MFA level for the guild */
|
|
45
|
+
mfa_level: integer;
|
|
46
|
+
/** application id of the guild creator if it is bot-created */
|
|
47
|
+
application_id?: snowflake;
|
|
48
|
+
/** the id of the channel where guild notices such as welcome messages and boost events are posted */
|
|
49
|
+
system_channel_id?: snowflake;
|
|
50
|
+
/** system channel flags */
|
|
51
|
+
system_channel_flags: integer;
|
|
52
|
+
/** the id of the channel where Community guilds can display rules and/or guidelines */
|
|
53
|
+
rules_channel_id?: snowflake;
|
|
54
|
+
/** when this guild was joined at */
|
|
55
|
+
joined_at?: timestamp;
|
|
56
|
+
/** true if this is considered a large guild */
|
|
57
|
+
large?: boolean;
|
|
58
|
+
/** true if this guild is unavailable due to an outage */
|
|
59
|
+
unavailable?: boolean;
|
|
60
|
+
/** total number of members in this guild */
|
|
61
|
+
member_count?: integer;
|
|
62
|
+
/** states of members currently in voice channels; lacks the guild_id key */
|
|
63
|
+
voice_states?: Partial<VoiceState>[];
|
|
64
|
+
/** users in the guild */
|
|
65
|
+
members?: GuildMember[];
|
|
66
|
+
/** channels in the guild */
|
|
67
|
+
channels?: Channel[];
|
|
68
|
+
/** all active threads in the guild that current user has permission to view */
|
|
69
|
+
threads?: Channel[];
|
|
70
|
+
/** presences of the members in the guild, will only include non-offline members if the size is greater than large threshold */
|
|
71
|
+
presences?: Partial<PresenceUpdateEvent>[];
|
|
72
|
+
/** the maximum number of presences for the guild (null is always returned, apart from the largest of guilds) */
|
|
73
|
+
max_presences?: integer;
|
|
74
|
+
/** the maximum number of members for the guild */
|
|
75
|
+
max_members?: integer;
|
|
76
|
+
/** the vanity url code for the guild */
|
|
77
|
+
vanity_url_code?: string;
|
|
78
|
+
/** the description of a Community guild */
|
|
79
|
+
description?: string;
|
|
80
|
+
/** banner hash */
|
|
81
|
+
banner?: string;
|
|
82
|
+
/** premium tier (Server Boost level) */
|
|
83
|
+
premium_tier: integer;
|
|
84
|
+
/** the number of boosts this guild currently has */
|
|
85
|
+
premium_subscription_count?: integer;
|
|
86
|
+
/** the preferred locale of a Community guild; used in server discovery and notices from Discord; defaults to "en-US" */
|
|
87
|
+
preferred_locale: string;
|
|
88
|
+
/** the id of the channel where admins and moderators of Community guilds receive notices from Discord */
|
|
89
|
+
public_updates_channel_id?: snowflake;
|
|
90
|
+
/** the maximum amount of users in a video channel */
|
|
91
|
+
max_video_channel_users?: integer;
|
|
92
|
+
/** approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true */
|
|
93
|
+
approximate_member_count?: integer;
|
|
94
|
+
/** approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true */
|
|
95
|
+
approximate_presence_count?: integer;
|
|
96
|
+
/** the welcome screen of a Community guild, shown to new members, returned in an Invite's guild object */
|
|
97
|
+
welcome_screen?: WelcomeScreen;
|
|
98
|
+
/** guild NSFW level */
|
|
99
|
+
nsfw_level: integer;
|
|
100
|
+
/** Stage instances in the guild */
|
|
101
|
+
stage_instances?: StageInstance[];
|
|
102
|
+
/** custom guild stickers */
|
|
103
|
+
stickers?: Sticker[];
|
|
104
|
+
}
|
|
105
|
+
/** https://discord.com/developers/docs/resources/guild#guild-object-system-channel-flags */
|
|
106
|
+
export declare enum SystemChannelFlag {
|
|
107
|
+
/** Suppress member join notifications */
|
|
108
|
+
SUPPRESS_JOIN_NOTIFICATIONS = 1,
|
|
109
|
+
/** Suppress server boost notifications */
|
|
110
|
+
SUPPRESS_PREMIUM_SUBSCRIPTIONS = 2,
|
|
111
|
+
/** Suppress server setup tips */
|
|
112
|
+
SUPPRESS_GUILD_REMINDER_NOTIFICATIONS = 4
|
|
113
|
+
}
|
|
114
|
+
/** https://discord.com/developers/docs/resources/guild#guild-object-guild-features */
|
|
115
|
+
export declare enum GuildFeature {
|
|
116
|
+
/** guild has access to set an animated guild icon */
|
|
117
|
+
ANIMATED_ICON = "ANIMATED_ICON",
|
|
118
|
+
/** guild has access to set a guild banner image */
|
|
119
|
+
BANNER = "BANNER",
|
|
120
|
+
/** guild has access to use commerce features (i.e. create store channels) */
|
|
121
|
+
COMMERCE = "COMMERCE",
|
|
122
|
+
/** guild can enable welcome screen, Membership Screening, stage channels and discovery, and receives community updates */
|
|
123
|
+
COMMUNITY = "COMMUNITY",
|
|
124
|
+
/** guild is able to be discovered in the directory */
|
|
125
|
+
DISCOVERABLE = "DISCOVERABLE",
|
|
126
|
+
/** guild is able to be featured in the directory */
|
|
127
|
+
FEATURABLE = "FEATURABLE",
|
|
128
|
+
/** guild has access to set an invite splash background */
|
|
129
|
+
INVITE_SPLASH = "INVITE_SPLASH",
|
|
130
|
+
/** guild has enabled Membership Screening */
|
|
131
|
+
MEMBER_VERIFICATION_GATE_ENABLED = "MEMBER_VERIFICATION_GATE_ENABLED",
|
|
132
|
+
/** guild has enabled monetization */
|
|
133
|
+
MONETIZATION_ENABLED = "MONETIZATION_ENABLED",
|
|
134
|
+
/** guild has increased custom sticker slots */
|
|
135
|
+
MORE_STICKERS = "MORE_STICKERS",
|
|
136
|
+
/** guild has access to create news channels */
|
|
137
|
+
NEWS = "NEWS",
|
|
138
|
+
/** guild is partnered */
|
|
139
|
+
PARTNERED = "PARTNERED",
|
|
140
|
+
/** guild can be previewed before joining via Membership Screening or the directory */
|
|
141
|
+
PREVIEW_ENABLED = "PREVIEW_ENABLED",
|
|
142
|
+
/** guild has access to create private threads */
|
|
143
|
+
PRIVATE_THREADS = "PRIVATE_THREADS",
|
|
144
|
+
/** guild is able to set role icons */
|
|
145
|
+
ROLE_ICONS = "ROLE_ICONS",
|
|
146
|
+
/** guild has access to the seven day archive time for threads */
|
|
147
|
+
SEVEN_DAY_THREAD_ARCHIVE = "SEVEN_DAY_THREAD_ARCHIVE",
|
|
148
|
+
/** guild has access to the three day archive time for threads */
|
|
149
|
+
THREE_DAY_THREAD_ARCHIVE = "THREE_DAY_THREAD_ARCHIVE",
|
|
150
|
+
/** guild has enabled ticketed events */
|
|
151
|
+
TICKETED_EVENTS_ENABLED = "TICKETED_EVENTS_ENABLED",
|
|
152
|
+
/** guild has access to set a vanity URL */
|
|
153
|
+
VANITY_URL = "VANITY_URL",
|
|
154
|
+
/** guild is verified */
|
|
155
|
+
VERIFIED = "VERIFIED",
|
|
156
|
+
/** guild has access to set 384kbps bitrate in voice (previously VIP voice servers) */
|
|
157
|
+
VIP_REGIONS = "VIP_REGIONS",
|
|
158
|
+
/** guild has enabled the welcome screen */
|
|
159
|
+
WELCOME_SCREEN_ENABLED = "WELCOME_SCREEN_ENABLED"
|
|
160
|
+
}
|
|
161
|
+
/** https://discord.com/developers/docs/resources/guild#guild-preview-object-guild-preview-structure */
|
|
162
|
+
export interface GuildPreview {
|
|
163
|
+
/** guild id */
|
|
164
|
+
id: snowflake;
|
|
165
|
+
/** guild name (2-100 characters) */
|
|
166
|
+
name: string;
|
|
167
|
+
/** icon hash */
|
|
168
|
+
icon?: string;
|
|
169
|
+
/** splash hash */
|
|
170
|
+
splash?: string;
|
|
171
|
+
/** discovery splash hash */
|
|
172
|
+
discovery_splash?: string;
|
|
173
|
+
/** custom guild emojis */
|
|
174
|
+
emojis: Emoji[];
|
|
175
|
+
/** enabled guild features */
|
|
176
|
+
features: GuildFeature[];
|
|
177
|
+
/** approximate number of members in this guild */
|
|
178
|
+
approximate_member_count: integer;
|
|
179
|
+
/** approximate number of online members in this guild */
|
|
180
|
+
approximate_presence_count: integer;
|
|
181
|
+
/** the description for the guild, if the guild is discoverable */
|
|
182
|
+
description?: string;
|
|
183
|
+
}
|
|
184
|
+
/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */
|
|
185
|
+
export interface GuildWidget {
|
|
186
|
+
/** whether the widget is enabled */
|
|
187
|
+
enabled: boolean;
|
|
188
|
+
/** the widget channel id */
|
|
189
|
+
channel_id?: snowflake;
|
|
190
|
+
}
|
|
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
|
+
/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure */
|
|
199
|
+
export interface WelcomeScreen {
|
|
200
|
+
/** the server description shown in the welcome screen */
|
|
201
|
+
description?: string;
|
|
202
|
+
/** the channels shown in the welcome screen, up to 5 */
|
|
203
|
+
welcome_channels: WelcomeScreenChannel[];
|
|
204
|
+
}
|
|
205
|
+
/** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-channel-structure */
|
|
206
|
+
export interface WelcomeScreenChannel {
|
|
207
|
+
/** the channel's id */
|
|
208
|
+
channel_id: snowflake;
|
|
209
|
+
/** the description shown for the channel */
|
|
210
|
+
description: string;
|
|
211
|
+
/** the emoji id, if the emoji is custom */
|
|
212
|
+
emoji_id?: snowflake;
|
|
213
|
+
/** the emoji name if custom, the unicode character if standard, or null if no emoji is set */
|
|
214
|
+
emoji_name?: string;
|
|
215
|
+
}
|
|
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
|
+
declare module './gateway' {
|
|
237
|
+
interface GatewayEvents {
|
|
238
|
+
/** lazy-load for unavailable guild, guild became available, or user joined a new guild */
|
|
239
|
+
GUILD_CREATE: GuildCreateEvent;
|
|
240
|
+
/** guild was updated */
|
|
241
|
+
GUILD_UPDATE: GuildUpdateEvent;
|
|
242
|
+
/** guild became unavailable, or user left/was removed from a guild */
|
|
243
|
+
GUILD_DELETE: GuildDeleteEvent;
|
|
244
|
+
/** user was banned from a guild */
|
|
245
|
+
GUILD_BAN_ADD: GuildBanAddEvent;
|
|
246
|
+
/** user was unbanned from a guild */
|
|
247
|
+
GUILD_BAN_REMOVE: GuildBanRemoveEvent;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
declare module './internal' {
|
|
251
|
+
interface Internal {
|
|
252
|
+
/** https://discord.com/developers/docs/resources/user#get-current-user-guilds */
|
|
253
|
+
getCurrentUserGuilds(): Promise<Guild[]>;
|
|
254
|
+
/** https://discord.com/developers/docs/resources/user#leave-guild */
|
|
255
|
+
leaveGuild(guild_id: snowflake): Promise<void>;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
declare module './internal' {
|
|
259
|
+
interface Internal {
|
|
260
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
|
261
|
+
getGuild(guild_id: snowflake): Promise<Guild>;
|
|
262
|
+
/** https://discord.com/developers/docs/resources/guild#get-guild-preview */
|
|
263
|
+
getGuildPreview(guild_id: snowflake): Promise<GuildPreview>;
|
|
264
|
+
/** https://discord.com/developers/docs/resources/guild#modify-guild */
|
|
265
|
+
modifyGuild(guild_id: snowflake, options: Partial<Guild>): Promise<Guild>;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export * from './internal';
|
|
2
|
+
export * from './application';
|
|
3
|
+
export * from './audit-log';
|
|
4
|
+
export * from './channel';
|
|
5
|
+
export * from './command';
|
|
6
|
+
export * from './component';
|
|
7
|
+
export * from './device';
|
|
8
|
+
export * from './emoji';
|
|
9
|
+
export * from './gateway';
|
|
10
|
+
export * from './guild-member';
|
|
11
|
+
export * from './guild-template';
|
|
12
|
+
export * from './guild';
|
|
13
|
+
export * from './integration';
|
|
14
|
+
export * from './interaction';
|
|
15
|
+
export * from './invite';
|
|
16
|
+
export * from './message';
|
|
17
|
+
export * from './presence';
|
|
18
|
+
export * from './role';
|
|
19
|
+
export * from './stage-instance';
|
|
20
|
+
export * from './sticker';
|
|
21
|
+
export * from './team';
|
|
22
|
+
export * from './user';
|
|
23
|
+
export * from './voice';
|
|
24
|
+
export * from './webhook';
|
|
25
|
+
export declare type integer = number;
|
|
26
|
+
export declare type snowflake = string;
|
|
27
|
+
export declare type timestamp = string;
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { AllowedMentions, ApplicationCommandInteractionDataOption, 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/receiving-and-responding#interaction-object-interaction-data-structure */
|
|
34
|
+
export interface InteractionData {
|
|
35
|
+
/** the ID of the invoked command */
|
|
36
|
+
id: snowflake;
|
|
37
|
+
/** the name of the invoked command */
|
|
38
|
+
name: string;
|
|
39
|
+
/** the type of the invoked command */
|
|
40
|
+
type: integer;
|
|
41
|
+
/** converted users + roles + channels */
|
|
42
|
+
resolved?: ResolvedData;
|
|
43
|
+
/** the params + values from the user */
|
|
44
|
+
options?: ApplicationCommandInteractionDataOption[];
|
|
45
|
+
/** the custom_id of the component */
|
|
46
|
+
custom_id?: string;
|
|
47
|
+
/** the type of the component */
|
|
48
|
+
component_type?: integer;
|
|
49
|
+
/** the values the user selected */
|
|
50
|
+
values?: SelectOption[];
|
|
51
|
+
/** id the of user or message targetted by a user or message command */
|
|
52
|
+
target_id?: snowflake;
|
|
53
|
+
}
|
|
54
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure */
|
|
55
|
+
export interface ResolvedData {
|
|
56
|
+
/** the ids and User objects */
|
|
57
|
+
users?: Record<snowflake, User>;
|
|
58
|
+
/** the ids and partial Member objects */
|
|
59
|
+
members?: Record<snowflake, Partial<GuildMember>>;
|
|
60
|
+
/** the ids and Role objects */
|
|
61
|
+
roles?: Record<snowflake, Role>;
|
|
62
|
+
/** the ids and partial Channel objects */
|
|
63
|
+
channels?: Record<snowflake, Partial<Channel>>;
|
|
64
|
+
/** the ids and partial Message objects */
|
|
65
|
+
messages?: Record<snowflake, Partial<Message>>;
|
|
66
|
+
}
|
|
67
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#message-interaction-object-message-interaction-structure */
|
|
68
|
+
export interface MessageInteraction {
|
|
69
|
+
/** id of the interaction */
|
|
70
|
+
id: snowflake;
|
|
71
|
+
/** the type of interaction */
|
|
72
|
+
type: InteractionType;
|
|
73
|
+
/** the name of the application command */
|
|
74
|
+
name: string;
|
|
75
|
+
/** the user who invoked the interaction */
|
|
76
|
+
user: User;
|
|
77
|
+
}
|
|
78
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-response-structure */
|
|
79
|
+
export interface InteractionResponse {
|
|
80
|
+
/** the type of response */
|
|
81
|
+
type: InteractionCallbackType;
|
|
82
|
+
/** an optional response message */
|
|
83
|
+
data?: InteractionCallbackData;
|
|
84
|
+
}
|
|
85
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type */
|
|
86
|
+
export declare enum InteractionCallbackType {
|
|
87
|
+
/** ACK a Ping */
|
|
88
|
+
PONG = 1,
|
|
89
|
+
/** respond to an interaction with a message */
|
|
90
|
+
CHANNEL_MESSAGE_WITH_SOURCE = 4,
|
|
91
|
+
/** ACK an interaction and edit a response later, the user sees a loading state */
|
|
92
|
+
DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE = 5,
|
|
93
|
+
/** for components, ACK an interaction and edit the original message later; the user does not see a loading state */
|
|
94
|
+
DEFERRED_UPDATE_MESSAGE = 6,
|
|
95
|
+
/** for components, edit the message the component was attached to */
|
|
96
|
+
UPDATE_MESSAGE = 7
|
|
97
|
+
}
|
|
98
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure */
|
|
99
|
+
export interface InteractionCallbackData {
|
|
100
|
+
/** is the response TTS */
|
|
101
|
+
tts?: boolean;
|
|
102
|
+
/** message content */
|
|
103
|
+
content?: string;
|
|
104
|
+
/** supports up to 10 embeds */
|
|
105
|
+
embeds?: Embed[];
|
|
106
|
+
/** allowed mentions object */
|
|
107
|
+
allowed_mentions?: AllowedMentions;
|
|
108
|
+
/** interaction callback data flags */
|
|
109
|
+
flags?: integer;
|
|
110
|
+
/** message components */
|
|
111
|
+
components?: Component[];
|
|
112
|
+
}
|
|
113
|
+
/** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-flags */
|
|
114
|
+
export declare enum InteractionCallbackDataFlag {
|
|
115
|
+
/** only the user receiving the message can see it */
|
|
116
|
+
EPHEMERAL = 64
|
|
117
|
+
}
|
|
118
|
+
export interface InteractionCreateEvent extends Interaction {
|
|
119
|
+
}
|
|
120
|
+
declare module './gateway' {
|
|
121
|
+
interface GatewayEvents {
|
|
122
|
+
/** user used an interaction, such as an Application Command */
|
|
123
|
+
INTERACTION_CREATE: InteractionCreateEvent;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Quester } from 'koishi';
|
|
2
|
+
declare type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
3
|
+
export declare class Internal {
|
|
4
|
+
private http;
|
|
5
|
+
static define(routes: Record<string, Partial<Record<Method, string>>>): void;
|
|
6
|
+
constructor(http: Quester);
|
|
7
|
+
}
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
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?: integer;
|
|
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?: InviteStageInstance;
|
|
26
|
+
}
|
|
27
|
+
/** https://discord.com/developers/docs/resources/invite#invite-object-invite-target-types */
|
|
28
|
+
export declare enum InviteTargetType {
|
|
29
|
+
STREAM = 1,
|
|
30
|
+
EMBEDDED_APPLICATION = 2
|
|
31
|
+
}
|
|
32
|
+
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
33
|
+
export interface InviteMetadata {
|
|
34
|
+
/** number of times this invite has been used */
|
|
35
|
+
uses: integer;
|
|
36
|
+
/** max number of times this invite can be used */
|
|
37
|
+
max_uses: integer;
|
|
38
|
+
/** duration (in seconds) after which the invite expires */
|
|
39
|
+
max_age: integer;
|
|
40
|
+
/** whether this invite only grants temporary membership */
|
|
41
|
+
temporary: boolean;
|
|
42
|
+
/** when this invite was created */
|
|
43
|
+
created_at: timestamp;
|
|
44
|
+
}
|
|
45
|
+
/** https://discord.com/developers/docs/resources/invite#invite-stage-instance-object-invite-stage-instance-structure */
|
|
46
|
+
export interface InviteStageInstance {
|
|
47
|
+
/** the members speaking in the Stage */
|
|
48
|
+
members: Partial<GuildMember>[];
|
|
49
|
+
/** the number of users in the Stage */
|
|
50
|
+
participant_count: integer;
|
|
51
|
+
/** the number of users speaking in the Stage */
|
|
52
|
+
speaker_count: integer;
|
|
53
|
+
/** the topic of the Stage instance (1-120 characters) */
|
|
54
|
+
topic: string;
|
|
55
|
+
}
|
|
56
|
+
/** https://discord.com/developers/docs/topics/gateway#invite-create-invite-create-event-fields */
|
|
57
|
+
export interface InviteCreateEvent {
|
|
58
|
+
/** the channel the invite is for */
|
|
59
|
+
channel_id: snowflake;
|
|
60
|
+
/** the unique invite code */
|
|
61
|
+
code: string;
|
|
62
|
+
/** the time at which the invite was created */
|
|
63
|
+
created_at: timestamp;
|
|
64
|
+
/** the guild of the invite */
|
|
65
|
+
guild_id?: snowflake;
|
|
66
|
+
/** the user that created the invite */
|
|
67
|
+
inviter?: User;
|
|
68
|
+
/** how long the invite is valid for (in seconds) */
|
|
69
|
+
max_age: integer;
|
|
70
|
+
/** the maximum number of times the invite can be used */
|
|
71
|
+
max_uses: integer;
|
|
72
|
+
/** the type of target for this voice channel invite */
|
|
73
|
+
target_type?: integer;
|
|
74
|
+
/** the user whose stream to display for this voice channel stream invite */
|
|
75
|
+
target_user?: User;
|
|
76
|
+
/** the embedded application to open for this voice channel embedded application invite */
|
|
77
|
+
target_application?: Partial<Application>;
|
|
78
|
+
/** whether or not the invite is temporary (invited users will be kicked on disconnect unless they're assigned a role) */
|
|
79
|
+
temporary: boolean;
|
|
80
|
+
/** how many times the invite has been used (always will be 0) */
|
|
81
|
+
uses: integer;
|
|
82
|
+
}
|
|
83
|
+
/** https://discord.com/developers/docs/topics/gateway#invite-delete-invite-delete-event-fields */
|
|
84
|
+
export interface InviteDeleteEvent {
|
|
85
|
+
/** the channel of the invite */
|
|
86
|
+
channel_id: snowflake;
|
|
87
|
+
/** the guild of the invite */
|
|
88
|
+
guild_id?: snowflake;
|
|
89
|
+
/** the unique invite code */
|
|
90
|
+
code: string;
|
|
91
|
+
}
|
|
92
|
+
declare module './gateway' {
|
|
93
|
+
interface GatewayEvents {
|
|
94
|
+
/** invite to a channel was created */
|
|
95
|
+
INVITE_CREATE: InviteCreateEvent;
|
|
96
|
+
/** invite to a channel was deleted */
|
|
97
|
+
INVITE_DELETE: InviteDeleteEvent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
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
|
+
declare module './internal' {
|
|
107
|
+
interface Internal {
|
|
108
|
+
/** https://discord.com/developers/docs/resources/invite#get-invite */
|
|
109
|
+
getInvite(code: string, options?: GetInviteOptions): Promise<Invite>;
|
|
110
|
+
/** https://discord.com/developers/docs/resources/invite#delete-invite */
|
|
111
|
+
deleteInvite(code: string): Promise<Invite>;
|
|
112
|
+
}
|
|
113
|
+
}
|