chapterjs 0.1.2 → 0.2.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/dist/assets/asset.d.ts +46 -0
- package/dist/assets/asset.js +86 -0
- package/dist/assets/public.d.ts +19 -0
- package/dist/assets/public.js +120 -0
- package/dist/cache/cache.d.ts +62 -0
- package/dist/cache/cache.js +80 -0
- package/dist/cache/store.d.ts +45 -0
- package/dist/cache/store.js +53 -0
- package/dist/cli/build.d.ts +41 -0
- package/dist/cli/build.js +205 -0
- package/dist/cli/cli.js +108 -25
- package/dist/cli/cluster.d.ts +70 -0
- package/dist/cli/cluster.js +213 -0
- package/dist/cli/dev.d.ts +18 -1
- package/dist/cli/dev.js +253 -198
- package/dist/cli/env.d.ts +31 -0
- package/dist/cli/env.js +93 -0
- package/dist/cli/log.d.ts +13 -0
- package/dist/cli/log.js +17 -0
- package/dist/cli/node-version.d.ts +8 -0
- package/dist/cli/node-version.js +13 -0
- package/dist/cli/preflight.d.ts +36 -0
- package/dist/cli/preflight.js +122 -0
- package/dist/cli/project.d.ts +135 -0
- package/dist/cli/project.js +517 -0
- package/dist/cli/start.d.ts +25 -0
- package/dist/cli/start.js +225 -0
- package/dist/commands/autocomplete.d.ts +13 -0
- package/dist/commands/autocomplete.js +159 -0
- package/dist/commands/command.d.ts +360 -0
- package/dist/commands/command.js +28 -0
- package/dist/commands/declaration.d.ts +77 -0
- package/dist/commands/declaration.js +492 -0
- package/dist/commands/register.d.ts +18 -0
- package/dist/commands/register.js +42 -0
- package/dist/commands/router.d.ts +20 -0
- package/dist/commands/router.js +228 -0
- package/dist/commands/tree.d.ts +47 -0
- package/dist/commands/tree.js +216 -0
- package/dist/commands/twins.d.ts +15 -0
- package/dist/commands/twins.js +78 -0
- package/dist/components/button.d.ts +79 -0
- package/dist/components/button.js +106 -0
- package/dist/components/component.d.ts +140 -0
- package/dist/components/component.js +39 -0
- package/dist/components/custom-id.d.ts +72 -0
- package/dist/components/custom-id.js +128 -0
- package/dist/components/declaration.d.ts +42 -0
- package/dist/components/declaration.js +342 -0
- package/dist/components/declared.d.ts +29 -0
- package/dist/components/declared.js +49 -0
- package/dist/components/embed.d.ts +29 -0
- package/dist/components/embed.js +11 -0
- package/dist/components/instance.d.ts +100 -0
- package/dist/components/instance.js +86 -0
- package/dist/components/layout.d.ts +103 -0
- package/dist/components/layout.js +279 -0
- package/dist/components/modal.d.ts +245 -0
- package/dist/components/modal.js +398 -0
- package/dist/components/options.d.ts +41 -0
- package/dist/components/options.js +101 -0
- package/dist/components/render.d.ts +12 -0
- package/dist/components/render.js +58 -0
- package/dist/components/router.d.ts +19 -0
- package/dist/components/router.js +251 -0
- package/dist/components/select.d.ts +146 -0
- package/dist/components/select.js +179 -0
- package/dist/core/bot.d.ts +99 -0
- package/dist/core/bot.js +174 -0
- package/dist/core/memory.d.ts +66 -0
- package/dist/core/memory.js +115 -0
- package/dist/discord/api.d.ts +112 -0
- package/dist/discord/api.js +115 -0
- package/dist/discord/cdn.d.ts +67 -0
- package/dist/discord/cdn.js +100 -0
- package/dist/discord/codes.d.ts +171 -0
- package/dist/discord/codes.js +421 -0
- package/dist/discord/endpoint.d.ts +56 -0
- package/dist/discord/endpoint.js +53 -0
- package/dist/discord/endpoints.d.ts +1529 -0
- package/dist/discord/endpoints.js +1139 -0
- package/dist/discord/formatting.d.ts +67 -0
- package/dist/discord/formatting.js +87 -0
- package/dist/discord/index.d.ts +10 -0
- package/dist/discord/index.js +13 -0
- package/dist/discord/intents.d.ts +48 -0
- package/dist/discord/intents.js +128 -0
- package/dist/discord/permissions.d.ts +94 -0
- package/dist/discord/permissions.js +185 -0
- package/dist/discord/snowflake.d.ts +21 -0
- package/dist/discord/snowflake.js +36 -0
- package/dist/discord/types/application-command.d.ts +332 -0
- package/dist/discord/types/application-command.js +48 -0
- package/dist/discord/types/application-role-connection-metadata.d.ts +42 -0
- package/dist/discord/types/application-role-connection-metadata.js +22 -0
- package/dist/discord/types/application.d.ts +208 -0
- package/dist/discord/types/application.js +48 -0
- package/dist/discord/types/audit-log.d.ts +255 -0
- package/dist/discord/types/audit-log.js +144 -0
- package/dist/discord/types/auto-moderation.d.ts +167 -0
- package/dist/discord/types/auto-moderation.js +52 -0
- package/dist/discord/types/channel.d.ts +557 -0
- package/dist/discord/types/channel.js +88 -0
- package/dist/discord/types/common.d.ts +54 -0
- package/dist/discord/types/common.js +38 -0
- package/dist/discord/types/component.d.ts +775 -0
- package/dist/discord/types/component.js +76 -0
- package/dist/discord/types/emoji.d.ts +74 -0
- package/dist/discord/types/emoji.js +1 -0
- package/dist/discord/types/entitlement.d.ts +84 -0
- package/dist/discord/types/entitlement.js +22 -0
- package/dist/discord/types/gateway-events.d.ts +1148 -0
- package/dist/discord/types/gateway-events.js +54 -0
- package/dist/discord/types/gateway.d.ts +38 -0
- package/dist/discord/types/gateway.js +1 -0
- package/dist/discord/types/guild-scheduled-event.d.ts +257 -0
- package/dist/discord/types/guild-scheduled-event.js +68 -0
- package/dist/discord/types/guild-template.d.ts +51 -0
- package/dist/discord/types/guild-template.js +1 -0
- package/dist/discord/types/guild.d.ts +910 -0
- package/dist/discord/types/guild.js +153 -0
- package/dist/discord/types/index.d.ts +31 -0
- package/dist/discord/types/index.js +31 -0
- package/dist/discord/types/interaction.d.ts +321 -0
- package/dist/discord/types/interaction.js +47 -0
- package/dist/discord/types/invite.d.ts +158 -0
- package/dist/discord/types/invite.js +39 -0
- package/dist/discord/types/message.d.ts +834 -0
- package/dist/discord/types/message.js +159 -0
- package/dist/discord/types/oauth2.d.ts +22 -0
- package/dist/discord/types/oauth2.js +1 -0
- package/dist/discord/types/permissions.d.ts +183 -0
- package/dist/discord/types/permissions.js +118 -0
- package/dist/discord/types/poll.d.ts +106 -0
- package/dist/discord/types/poll.js +8 -0
- package/dist/discord/types/sku.d.ts +47 -0
- package/dist/discord/types/sku.js +26 -0
- package/dist/discord/types/soundboard.d.ts +71 -0
- package/dist/discord/types/soundboard.js +1 -0
- package/dist/discord/types/stage-instance.d.ts +58 -0
- package/dist/discord/types/stage-instance.js +10 -0
- package/dist/discord/types/sticker.d.ts +115 -0
- package/dist/discord/types/sticker.js +20 -0
- package/dist/discord/types/subscription.d.ts +54 -0
- package/dist/discord/types/subscription.js +12 -0
- package/dist/discord/types/team.d.ts +55 -0
- package/dist/discord/types/team.js +21 -0
- package/dist/discord/types/user.d.ts +273 -0
- package/dist/discord/types/user.js +83 -0
- package/dist/discord/types/voice.d.ts +72 -0
- package/dist/discord/types/voice.js +1 -0
- package/dist/discord/types/webhook.d.ts +184 -0
- package/dist/discord/types/webhook.js +12 -0
- package/dist/events/declaration.d.ts +16 -0
- package/dist/events/declaration.js +80 -0
- package/dist/events/event.d.ts +45 -0
- package/dist/events/event.js +34 -0
- package/dist/events/registry.d.ts +697 -0
- package/dist/events/registry.js +839 -0
- package/dist/events/router.d.ts +46 -0
- package/dist/events/router.js +133 -0
- package/dist/gateway/errors.d.ts +18 -0
- package/dist/gateway/errors.js +47 -0
- package/dist/gateway/gateway.d.ts +64 -0
- package/dist/gateway/gateway.js +117 -0
- package/dist/gateway/identify-queue.d.ts +25 -0
- package/dist/gateway/identify-queue.js +29 -0
- package/dist/gateway/shard.d.ts +94 -0
- package/dist/gateway/shard.js +414 -0
- package/dist/gateway/state.d.ts +11 -0
- package/dist/gateway/state.js +184 -0
- package/dist/index.d.ts +57 -18
- package/dist/index.js +40 -12
- package/dist/interactions/cooldown.d.ts +33 -0
- package/dist/interactions/cooldown.js +74 -0
- package/dist/interactions/dispatch.d.ts +91 -0
- package/dist/interactions/dispatch.js +110 -0
- package/dist/loader/generated.d.ts +10 -0
- package/dist/loader/generated.js +80 -0
- package/dist/loader/hot.d.ts +13 -0
- package/dist/loader/hot.js +85 -0
- package/dist/loader/loader.d.ts +85 -0
- package/dist/loader/loader.js +119 -0
- package/dist/loader/locate.d.ts +10 -0
- package/dist/loader/locate.js +36 -0
- package/dist/loader/watch.d.ts +17 -0
- package/dist/loader/watch.js +66 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +5 -0
- package/dist/messages/commands.d.ts +23 -0
- package/dist/messages/commands.js +142 -0
- package/dist/messages/declaration.d.ts +89 -0
- package/dist/messages/declaration.js +455 -0
- package/dist/messages/messages.d.ts +241 -0
- package/dist/messages/messages.js +31 -0
- package/dist/messages/phrases.d.ts +23 -0
- package/dist/messages/phrases.js +44 -0
- package/dist/messages/translate.d.ts +100 -0
- package/dist/messages/translate.js +249 -0
- package/dist/presence/declaration.d.ts +19 -0
- package/dist/presence/declaration.js +118 -0
- package/dist/presence/presence.d.ts +57 -0
- package/dist/presence/presence.js +27 -0
- package/dist/rest/errors.d.ts +55 -0
- package/dist/rest/errors.js +92 -0
- package/dist/rest/rate-limiter.d.ts +46 -0
- package/dist/rest/rate-limiter.js +153 -0
- package/dist/rest/rest.d.ts +63 -0
- package/dist/rest/rest.js +194 -0
- package/dist/structures/base.d.ts +48 -0
- package/dist/structures/base.js +84 -0
- package/dist/structures/channel.d.ts +380 -0
- package/dist/structures/channel.js +627 -0
- package/dist/structures/context.d.ts +30 -0
- package/dist/structures/context.js +7 -0
- package/dist/structures/emoji.d.ts +46 -0
- package/dist/structures/emoji.js +65 -0
- package/dist/structures/entities.d.ts +62 -0
- package/dist/structures/entities.js +226 -0
- package/dist/structures/guild.d.ts +348 -0
- package/dist/structures/guild.js +466 -0
- package/dist/structures/interaction.d.ts +197 -0
- package/dist/structures/interaction.js +396 -0
- package/dist/structures/invite.d.ts +38 -0
- package/dist/structures/invite.js +57 -0
- package/dist/structures/known.d.ts +28 -0
- package/dist/structures/known.js +58 -0
- package/dist/structures/member.d.ts +140 -0
- package/dist/structures/member.js +260 -0
- package/dist/structures/message.d.ts +197 -0
- package/dist/structures/message.js +268 -0
- package/dist/structures/payload.d.ts +91 -0
- package/dist/structures/payload.js +184 -0
- package/dist/structures/role.d.ts +69 -0
- package/dist/structures/role.js +112 -0
- package/dist/structures/user.d.ts +59 -0
- package/dist/structures/user.js +94 -0
- package/dist/structures/webhook.d.ts +46 -0
- package/dist/structures/webhook.js +79 -0
- package/dist/tasks/declaration.d.ts +16 -0
- package/dist/tasks/declaration.js +56 -0
- package/dist/tasks/schedule.d.ts +54 -0
- package/dist/tasks/schedule.js +236 -0
- package/dist/tasks/scheduler.d.ts +35 -0
- package/dist/tasks/scheduler.js +107 -0
- package/dist/tasks/task.d.ts +75 -0
- package/dist/tasks/task.js +27 -0
- package/dist/util/case.d.ts +13 -0
- package/dist/util/case.js +54 -0
- package/dist/util/duration.d.ts +8 -0
- package/dist/util/duration.js +29 -0
- package/dist/util/websocket.d.ts +9 -0
- package/dist/util/websocket.js +31 -0
- package/dist/voice/connection.d.ts +90 -0
- package/dist/voice/connection.js +494 -0
- package/dist/voice/dave.d.ts +109 -0
- package/dist/voice/dave.js +245 -0
- package/dist/voice/opus.d.ts +19 -0
- package/dist/voice/opus.js +273 -0
- package/dist/voice/session.d.ts +55 -0
- package/dist/voice/session.js +405 -0
- package/dist/voice/source.d.ts +22 -0
- package/dist/voice/source.js +195 -0
- package/dist/voice/transport.d.ts +43 -0
- package/dist/voice/transport.js +140 -0
- package/dist/voice/usage.d.ts +4 -0
- package/dist/voice/usage.js +33 -0
- package/package.json +26 -7
- package/vendor/dave/LICENSE +231 -0
- package/vendor/dave/libdave.d.mts +99 -0
- package/vendor/dave/libdave.mjs +2 -0
- package/vendor/dave/libdave.wasm +0 -0
- package/dist/components.d.ts +0 -97
- package/dist/components.js +0 -260
- package/dist/context.d.ts +0 -72
- package/dist/context.js +0 -273
- package/dist/discord/client.d.ts +0 -35
- package/dist/discord/client.js +0 -66
- package/dist/discord/constants.d.ts +0 -49
- package/dist/discord/constants.js +0 -61
- package/dist/discord/events.d.ts +0 -129
- package/dist/discord/events.js +0 -102
- package/dist/discord/gateway.d.ts +0 -61
- package/dist/discord/gateway.js +0 -320
- package/dist/discord/payloads.d.ts +0 -275
- package/dist/discord/payloads.js +0 -3
- package/dist/discord/presence.d.ts +0 -42
- package/dist/discord/presence.js +0 -51
- package/dist/discord/rest.d.ts +0 -49
- package/dist/discord/rest.js +0 -271
- package/dist/discord/types.d.ts +0 -334
- package/dist/discord/types.js +0 -4
- package/dist/events.d.ts +0 -94
- package/dist/events.js +0 -255
- package/dist/presence.d.ts +0 -92
- package/dist/presence.js +0 -250
- package/dist/structures/Channel.d.ts +0 -110
- package/dist/structures/Channel.js +0 -171
- package/dist/structures/Guild.d.ts +0 -70
- package/dist/structures/Guild.js +0 -105
- package/dist/structures/Interaction.d.ts +0 -113
- package/dist/structures/Interaction.js +0 -274
- package/dist/structures/Member.d.ts +0 -70
- package/dist/structures/Member.js +0 -124
- package/dist/structures/Message.d.ts +0 -87
- package/dist/structures/Message.js +0 -182
- package/dist/structures/Reaction.d.ts +0 -38
- package/dist/structures/Reaction.js +0 -64
- package/dist/structures/Role.d.ts +0 -43
- package/dist/structures/Role.js +0 -77
- package/dist/structures/User.d.ts +0 -41
- package/dist/structures/User.js +0 -79
- package/dist/structures/utils.d.ts +0 -72
- package/dist/structures/utils.js +0 -59
- package/dist/utils/errors.d.ts +0 -5
- package/dist/utils/errors.js +0 -28
- package/dist/utils/modules.d.ts +0 -39
- package/dist/utils/modules.js +0 -156
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Image URLs, built from the ids and hashes Discord sends.
|
|
2
|
+
// https://docs.discord.com/developers/reference#image-formatting
|
|
3
|
+
import { CDN_BASE_URL, MEDIA_BASE_URL } from './api.js';
|
|
4
|
+
import { StickerFormatType } from './types/sticker.js';
|
|
5
|
+
const FORMATS = new Set([
|
|
6
|
+
'png',
|
|
7
|
+
'jpg',
|
|
8
|
+
'jpeg',
|
|
9
|
+
'webp',
|
|
10
|
+
'gif',
|
|
11
|
+
]);
|
|
12
|
+
function isSize(size) {
|
|
13
|
+
return (typeof size === 'number' &&
|
|
14
|
+
Number.isInteger(size) &&
|
|
15
|
+
size >= 16 &&
|
|
16
|
+
size <= 4096 &&
|
|
17
|
+
(size & (size - 1)) === 0);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the URL of an image. In the case of endpoints that support GIFs,
|
|
21
|
+
* the hash begins with `a_` when the image is animated: those are requested
|
|
22
|
+
* as animated WebP with `?animated=true`.
|
|
23
|
+
*/
|
|
24
|
+
function image(path, hash, { format = 'webp', size, animated = true } = {}, supportsGif = true) {
|
|
25
|
+
if (!FORMATS.has(format)) {
|
|
26
|
+
throw new RangeError(`"${format}" is not an image format. Use png, jpg, webp or gif.`);
|
|
27
|
+
}
|
|
28
|
+
if (size !== undefined && !isSize(size)) {
|
|
29
|
+
throw new RangeError(`${size} is not an image size. Use a power of two between 16 and 4096 (64, 128, 256...).`);
|
|
30
|
+
}
|
|
31
|
+
const isAnimated = supportsGif && hash !== null && hash.startsWith('a_');
|
|
32
|
+
if (format === 'gif' && !isAnimated)
|
|
33
|
+
format = 'png';
|
|
34
|
+
const query = new URLSearchParams();
|
|
35
|
+
if (size !== undefined)
|
|
36
|
+
query.set('size', String(size));
|
|
37
|
+
if (isAnimated && animated && format === 'webp')
|
|
38
|
+
query.set('animated', 'true');
|
|
39
|
+
const search = query.size > 0 ? `?${query}` : '';
|
|
40
|
+
return `${CDN_BASE_URL}/${path}.${format}${search}`;
|
|
41
|
+
}
|
|
42
|
+
/** @see https://docs.discord.com/developers/reference#image-formatting-cdn-endpoints */
|
|
43
|
+
export const cdn = {
|
|
44
|
+
/** Custom Emoji */
|
|
45
|
+
emoji: (emojiId, animated, options) => image(`emojis/${emojiId}`, animated ? 'a_' : '', options),
|
|
46
|
+
/** Guild Icon */
|
|
47
|
+
guildIcon: (guildId, hash, options) => image(`icons/${guildId}/${hash}`, hash, options),
|
|
48
|
+
/** Guild Splash */
|
|
49
|
+
guildSplash: (guildId, hash, options) => image(`splashes/${guildId}/${hash}`, hash, options, false),
|
|
50
|
+
/** Guild Discovery Splash */
|
|
51
|
+
guildDiscoverySplash: (guildId, hash, options) => image(`discovery-splashes/${guildId}/${hash}`, hash, options, false),
|
|
52
|
+
/** Guild Banner */
|
|
53
|
+
guildBanner: (guildId, hash, options) => image(`banners/${guildId}/${hash}`, hash, options),
|
|
54
|
+
/** User Banner */
|
|
55
|
+
userBanner: (userId, hash, options) => image(`banners/${userId}/${hash}`, hash, options),
|
|
56
|
+
/**
|
|
57
|
+
* Default User Avatar: always a PNG of a fixed size. The index is
|
|
58
|
+
* `(user_id >> 22) % 6` for users on the new username system and
|
|
59
|
+
* `discriminator % 5` for the others.
|
|
60
|
+
*/
|
|
61
|
+
defaultUserAvatar: (userId, discriminator) => {
|
|
62
|
+
const legacy = discriminator !== '0' && discriminator !== '';
|
|
63
|
+
const index = legacy
|
|
64
|
+
? Number(discriminator) % 5
|
|
65
|
+
: Number((BigInt(userId) >> 22n) % 6n);
|
|
66
|
+
return `${CDN_BASE_URL}/embed/avatars/${index}.png`;
|
|
67
|
+
},
|
|
68
|
+
/** User Avatar */
|
|
69
|
+
userAvatar: (userId, hash, options) => image(`avatars/${userId}/${hash}`, hash, options),
|
|
70
|
+
/** Guild Member Avatar */
|
|
71
|
+
memberAvatar: (guildId, userId, hash, options) => image(`guilds/${guildId}/users/${userId}/avatars/${hash}`, hash, options),
|
|
72
|
+
/** Guild Member Banner */
|
|
73
|
+
memberBanner: (guildId, userId, hash, options) => image(`guilds/${guildId}/users/${userId}/banners/${hash}`, hash, options),
|
|
74
|
+
/** Avatar Decoration: always a PNG. */
|
|
75
|
+
avatarDecoration: (asset) => `${CDN_BASE_URL}/avatar-decoration-presets/${asset}.png`,
|
|
76
|
+
/** Application Icon */
|
|
77
|
+
applicationIcon: (applicationId, hash, options) => image(`app-icons/${applicationId}/${hash}`, hash, options, false),
|
|
78
|
+
/** Application Cover */
|
|
79
|
+
applicationCover: (applicationId, hash, options) => image(`app-icons/${applicationId}/${hash}`, hash, options, false),
|
|
80
|
+
/** Team Icon */
|
|
81
|
+
teamIcon: (teamId, hash, options) => image(`team-icons/${teamId}/${hash}`, hash, options, false),
|
|
82
|
+
/**
|
|
83
|
+
* Sticker: a PNG if its format is PNG or APNG, a Lottie file (`.json`) if
|
|
84
|
+
* it is LOTTIE, and a GIF served by another host if it is GIF. The size
|
|
85
|
+
* is fixed.
|
|
86
|
+
*/
|
|
87
|
+
sticker: (stickerId, format) => {
|
|
88
|
+
if (format === StickerFormatType.Gif) {
|
|
89
|
+
return `${MEDIA_BASE_URL}/stickers/${stickerId}.gif`;
|
|
90
|
+
}
|
|
91
|
+
const extension = format === StickerFormatType.Lottie ? 'json' : 'png';
|
|
92
|
+
return `${CDN_BASE_URL}/stickers/${stickerId}.${extension}`;
|
|
93
|
+
},
|
|
94
|
+
/** Role Icon */
|
|
95
|
+
roleIcon: (roleId, hash, options) => image(`role-icons/${roleId}/${hash}`, hash, options, false),
|
|
96
|
+
/** Guild Scheduled Event Cover */
|
|
97
|
+
scheduledEventCover: (eventId, hash, options) => image(`guild-events/${eventId}/${hash}`, hash, options, false),
|
|
98
|
+
/** Guild Tag Badge */
|
|
99
|
+
guildTagBadge: (guildId, hash, options) => image(`guild-tag-badges/${guildId}/${hash}`, hash, options, false),
|
|
100
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway Opcodes
|
|
3
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-opcodes
|
|
4
|
+
*/
|
|
5
|
+
export declare const GatewayOpcode: {
|
|
6
|
+
/** An event was dispatched. */
|
|
7
|
+
readonly Dispatch: 0;
|
|
8
|
+
/** Fired periodically by the client to keep the connection alive. */
|
|
9
|
+
readonly Heartbeat: 1;
|
|
10
|
+
/** Starts a new session during the initial handshake. */
|
|
11
|
+
readonly Identify: 2;
|
|
12
|
+
/** Update the client's presence. */
|
|
13
|
+
readonly PresenceUpdate: 3;
|
|
14
|
+
/** Used to join/leave or move between voice channels. */
|
|
15
|
+
readonly VoiceStateUpdate: 4;
|
|
16
|
+
/** Resume a previous session that was disconnected. */
|
|
17
|
+
readonly Resume: 6;
|
|
18
|
+
/** You should attempt to reconnect and resume immediately. */
|
|
19
|
+
readonly Reconnect: 7;
|
|
20
|
+
/** Request information about offline guild members in a large guild. */
|
|
21
|
+
readonly RequestGuildMembers: 8;
|
|
22
|
+
/** The session has been invalidated. You should reconnect and identify/resume accordingly. */
|
|
23
|
+
readonly InvalidSession: 9;
|
|
24
|
+
/** Sent immediately after connecting, contains the `heartbeat_interval` to use. */
|
|
25
|
+
readonly Hello: 10;
|
|
26
|
+
/** Sent in response to receiving a heartbeat to acknowledge that it has been received. */
|
|
27
|
+
readonly HeartbeatAck: 11;
|
|
28
|
+
/** Request information about soundboard sounds in a set of guilds. */
|
|
29
|
+
readonly RequestSoundboardSounds: 31;
|
|
30
|
+
/** Request ephemeral channel data for channels in a guild. */
|
|
31
|
+
readonly RequestChannelInfo: 43;
|
|
32
|
+
};
|
|
33
|
+
export type GatewayOpcode = (typeof GatewayOpcode)[keyof typeof GatewayOpcode];
|
|
34
|
+
/**
|
|
35
|
+
* Gateway Close Event Codes
|
|
36
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
37
|
+
*/
|
|
38
|
+
export declare const GatewayCloseCode: {
|
|
39
|
+
readonly UnknownError: 4000;
|
|
40
|
+
readonly UnknownOpcode: 4001;
|
|
41
|
+
readonly DecodeError: 4002;
|
|
42
|
+
readonly NotAuthenticated: 4003;
|
|
43
|
+
readonly AuthenticationFailed: 4004;
|
|
44
|
+
readonly AlreadyAuthenticated: 4005;
|
|
45
|
+
readonly InvalidSeq: 4007;
|
|
46
|
+
readonly RateLimited: 4008;
|
|
47
|
+
readonly SessionTimedOut: 4009;
|
|
48
|
+
readonly InvalidShard: 4010;
|
|
49
|
+
readonly ShardingRequired: 4011;
|
|
50
|
+
readonly InvalidApiVersion: 4012;
|
|
51
|
+
readonly InvalidIntents: 4013;
|
|
52
|
+
readonly DisallowedIntents: 4014;
|
|
53
|
+
};
|
|
54
|
+
export type GatewayCloseCode = (typeof GatewayCloseCode)[keyof typeof GatewayCloseCode];
|
|
55
|
+
/**
|
|
56
|
+
* Close codes after which reconnecting is pointless: the "Reconnect" column
|
|
57
|
+
* of the table says `false`.
|
|
58
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
59
|
+
*/
|
|
60
|
+
export declare const FATAL_GATEWAY_CLOSE_CODES: ReadonlySet<number>;
|
|
61
|
+
/**
|
|
62
|
+
* Voice Opcodes
|
|
63
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#voice-voice-opcodes
|
|
64
|
+
*/
|
|
65
|
+
export declare const VoiceOpcode: {
|
|
66
|
+
/** Begin a voice websocket connection. */
|
|
67
|
+
readonly Identify: 0;
|
|
68
|
+
/** Select the voice protocol. */
|
|
69
|
+
readonly SelectProtocol: 1;
|
|
70
|
+
/** Complete the websocket handshake. */
|
|
71
|
+
readonly Ready: 2;
|
|
72
|
+
/** Keep the websocket connection alive. */
|
|
73
|
+
readonly Heartbeat: 3;
|
|
74
|
+
/** Describe the session. */
|
|
75
|
+
readonly SessionDescription: 4;
|
|
76
|
+
/** Indicate which users are speaking. */
|
|
77
|
+
readonly Speaking: 5;
|
|
78
|
+
/** Sent to acknowledge a received client heartbeat. */
|
|
79
|
+
readonly HeartbeatAck: 6;
|
|
80
|
+
/** Resume a connection. */
|
|
81
|
+
readonly Resume: 7;
|
|
82
|
+
/** Time to wait between sending heartbeats in milliseconds. */
|
|
83
|
+
readonly Hello: 8;
|
|
84
|
+
/** Acknowledge a successful session resume. */
|
|
85
|
+
readonly Resumed: 9;
|
|
86
|
+
/** One or more clients have connected to the voice channel */
|
|
87
|
+
readonly ClientsConnect: 11;
|
|
88
|
+
/** A client has disconnected from the voice channel */
|
|
89
|
+
readonly ClientDisconnect: 13;
|
|
90
|
+
/** A downgrade from the DAVE protocol is upcoming */
|
|
91
|
+
readonly DavePrepareTransition: 21;
|
|
92
|
+
/** Execute a previously announced protocol transition */
|
|
93
|
+
readonly DaveExecuteTransition: 22;
|
|
94
|
+
/** Acknowledge readiness previously announced transition */
|
|
95
|
+
readonly DaveTransitionReady: 23;
|
|
96
|
+
/** A DAVE protocol version or group change is upcoming */
|
|
97
|
+
readonly DavePrepareEpoch: 24;
|
|
98
|
+
/** Credential and public key for MLS external sender */
|
|
99
|
+
readonly DaveMlsExternalSender: 25;
|
|
100
|
+
/** MLS Key Package for pending group member */
|
|
101
|
+
readonly DaveMlsKeyPackage: 26;
|
|
102
|
+
/** MLS Proposals to be appended or revoked */
|
|
103
|
+
readonly DaveMlsProposals: 27;
|
|
104
|
+
/** MLS Commit with optional MLS Welcome messages */
|
|
105
|
+
readonly DaveMlsCommitWelcome: 28;
|
|
106
|
+
/** MLS Commit to be processed for upcoming transition */
|
|
107
|
+
readonly DaveMlsAnnounceCommitTransition: 29;
|
|
108
|
+
/** MLS Welcome to group for upcoming transition */
|
|
109
|
+
readonly DaveMlsWelcome: 30;
|
|
110
|
+
/** Flag invalid commit or welcome, request re-add */
|
|
111
|
+
readonly DaveMlsInvalidCommitWelcome: 31;
|
|
112
|
+
};
|
|
113
|
+
export type VoiceOpcode = (typeof VoiceOpcode)[keyof typeof VoiceOpcode];
|
|
114
|
+
/**
|
|
115
|
+
* Voice Close Event Codes
|
|
116
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#voice-voice-close-event-codes
|
|
117
|
+
*/
|
|
118
|
+
export declare const VoiceCloseCode: {
|
|
119
|
+
readonly UnknownOpcode: 4001;
|
|
120
|
+
readonly FailedToDecodePayload: 4002;
|
|
121
|
+
readonly NotAuthenticated: 4003;
|
|
122
|
+
readonly AuthenticationFailed: 4004;
|
|
123
|
+
readonly AlreadyAuthenticated: 4005;
|
|
124
|
+
readonly SessionNoLongerValid: 4006;
|
|
125
|
+
readonly SessionTimeout: 4009;
|
|
126
|
+
readonly ServerNotFound: 4011;
|
|
127
|
+
readonly UnknownProtocol: 4012;
|
|
128
|
+
readonly Disconnected: 4014;
|
|
129
|
+
readonly VoiceServerCrashed: 4015;
|
|
130
|
+
readonly UnknownEncryptionMode: 4016;
|
|
131
|
+
readonly E2eeDaveProtocolRequired: 4017;
|
|
132
|
+
readonly BadRequest: 4020;
|
|
133
|
+
readonly DisconnectedRateLimited: 4021;
|
|
134
|
+
readonly DisconnectedCallTerminated: 4022;
|
|
135
|
+
};
|
|
136
|
+
export type VoiceCloseCode = (typeof VoiceCloseCode)[keyof typeof VoiceCloseCode];
|
|
137
|
+
/**
|
|
138
|
+
* HTTP Response Codes
|
|
139
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#http-http-response-codes
|
|
140
|
+
*/
|
|
141
|
+
export declare const HttpStatus: {
|
|
142
|
+
/** The request completed successfully. */
|
|
143
|
+
readonly Ok: 200;
|
|
144
|
+
/** The entity was created successfully. */
|
|
145
|
+
readonly Created: 201;
|
|
146
|
+
/** The request completed successfully but returned no content. */
|
|
147
|
+
readonly NoContent: 204;
|
|
148
|
+
/** The entity was not modified (no action was taken). */
|
|
149
|
+
readonly NotModified: 304;
|
|
150
|
+
/** The request was improperly formatted, or the server couldn't understand it. */
|
|
151
|
+
readonly BadRequest: 400;
|
|
152
|
+
/** The `Authorization` header was missing or invalid. */
|
|
153
|
+
readonly Unauthorized: 401;
|
|
154
|
+
/** The `Authorization` token you passed did not have permission to the resource. */
|
|
155
|
+
readonly Forbidden: 403;
|
|
156
|
+
/** The resource at the location specified doesn't exist. */
|
|
157
|
+
readonly NotFound: 404;
|
|
158
|
+
/** The HTTP method used is not valid for the location specified. */
|
|
159
|
+
readonly MethodNotAllowed: 405;
|
|
160
|
+
/** You are being rate limited, see Rate Limits. */
|
|
161
|
+
readonly TooManyRequests: 429;
|
|
162
|
+
/** There was not a gateway available to process your request. Wait a bit and retry. */
|
|
163
|
+
readonly GatewayUnavailable: 502;
|
|
164
|
+
};
|
|
165
|
+
export type HttpStatus = (typeof HttpStatus)[keyof typeof HttpStatus];
|
|
166
|
+
/**
|
|
167
|
+
* JSON Error Codes: the `code` of an error response, with what Discord says
|
|
168
|
+
* it means.
|
|
169
|
+
* @see https://docs.discord.com/developers/topics/opcodes-and-status-codes#json-json-error-codes
|
|
170
|
+
*/
|
|
171
|
+
export declare const JSON_ERROR_CODES: Readonly<Record<number, string>>;
|