chapterjs 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +206 -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 +252 -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 +122 -0
- package/dist/cli/project.js +452 -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 +346 -0
- package/dist/commands/command.js +28 -0
- package/dist/commands/convention.d.ts +64 -0
- package/dist/commands/convention.js +464 -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 +43 -0
- package/dist/commands/tree.js +206 -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 +108 -0
- package/dist/components/component.d.ts +140 -0
- package/dist/components/component.js +39 -0
- package/dist/components/convention.d.ts +35 -0
- package/dist/components/convention.js +339 -0
- package/dist/components/custom-id.d.ts +72 -0
- package/dist/components/custom-id.js +128 -0
- package/dist/components/embed.d.ts +28 -0
- package/dist/components/embed.js +11 -0
- package/dist/components/file.d.ts +30 -0
- package/dist/components/file.js +52 -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 +244 -0
- package/dist/components/modal.js +399 -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 +18 -0
- package/dist/components/router.js +256 -0
- package/dist/components/select.d.ts +144 -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/convention.d.ts +25 -0
- package/dist/events/convention.js +97 -0
- package/dist/events/event.d.ts +8 -0
- package/dist/events/event.js +20 -0
- package/dist/events/registry.d.ts +706 -0
- package/dist/events/registry.js +839 -0
- package/dist/events/router.d.ts +45 -0
- package/dist/events/router.js +133 -0
- package/dist/events/types.d.ts +7 -0
- package/dist/events/types.js +48 -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 +55 -18
- package/dist/index.js +38 -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 +37 -0
- package/dist/loader/generated.js +114 -0
- package/dist/loader/hot.d.ts +13 -0
- package/dist/loader/hot.js +85 -0
- package/dist/loader/loader.d.ts +72 -0
- package/dist/loader/loader.js +135 -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 +3 -0
- package/dist/main.js +6 -0
- package/dist/messages/commands.d.ts +23 -0
- package/dist/messages/commands.js +123 -0
- package/dist/messages/convention.d.ts +89 -0
- package/dist/messages/convention.js +347 -0
- package/dist/messages/messages.d.ts +219 -0
- package/dist/messages/messages.js +30 -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/convention.d.ts +26 -0
- package/dist/presence/convention.js +133 -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/convention.d.ts +26 -0
- package/dist/tasks/convention.js +78 -0
- package/dist/tasks/schedule.d.ts +54 -0
- package/dist/tasks/schedule.js +236 -0
- package/dist/tasks/scheduler.d.ts +33 -0
- package/dist/tasks/scheduler.js +107 -0
- package/dist/tasks/task.d.ts +76 -0
- package/dist/tasks/task.js +28 -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
package/dist/context.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { Client } from './discord/client.js';
|
|
2
|
-
import type { EventName } from './discord/events.js';
|
|
3
|
-
import type { APIRateLimitedEvent, GatewayObject, PartialEmoji, Snowflake } from './discord/types.js';
|
|
4
|
-
import { Channel } from './structures/Channel.js';
|
|
5
|
-
import { Guild } from './structures/Guild.js';
|
|
6
|
-
import { Interaction } from './structures/Interaction.js';
|
|
7
|
-
import { Member } from './structures/Member.js';
|
|
8
|
-
import { Message } from './structures/Message.js';
|
|
9
|
-
import { Reaction } from './structures/Reaction.js';
|
|
10
|
-
import { Role } from './structures/Role.js';
|
|
11
|
-
import { User } from './structures/User.js';
|
|
12
|
-
/**
|
|
13
|
-
* What a handler receives. Each event only fills some keys, named after what
|
|
14
|
-
* it is about (`message` in messageCreate, `member` in guildMemberAdd…):
|
|
15
|
-
* reading a key the event doesn't have throws an error listing the right ones.
|
|
16
|
-
* Every event has `client` and `data`, the raw payload sent by Discord.
|
|
17
|
-
*/
|
|
18
|
-
export interface EventContext {
|
|
19
|
-
client: Client;
|
|
20
|
-
/** Payload sent by Discord, https://docs.discord.com/developers/events/gateway-events */
|
|
21
|
-
data: any;
|
|
22
|
-
user: User;
|
|
23
|
-
member: Member;
|
|
24
|
-
members: Member[];
|
|
25
|
-
message: Message;
|
|
26
|
-
/** Server of the event, for events that only happen in servers. Elsewhere, use `channel.guild`. */
|
|
27
|
-
guild: Guild;
|
|
28
|
-
guilds: Guild[];
|
|
29
|
-
channel: Channel;
|
|
30
|
-
thread: Channel;
|
|
31
|
-
threads: Channel[];
|
|
32
|
-
role: Role;
|
|
33
|
-
interaction: Interaction;
|
|
34
|
-
reaction: Reaction;
|
|
35
|
-
messageId: Snowflake;
|
|
36
|
-
messageIds: Snowflake[];
|
|
37
|
-
userId: Snowflake;
|
|
38
|
-
roleId: Snowflake;
|
|
39
|
-
scheduledEventId: Snowflake;
|
|
40
|
-
soundId: Snowflake;
|
|
41
|
-
integrationId: Snowflake;
|
|
42
|
-
/** Id of the poll answer. */
|
|
43
|
-
answerId: number;
|
|
44
|
-
/** Invite code. */
|
|
45
|
-
code: string;
|
|
46
|
-
emoji: PartialEmoji;
|
|
47
|
-
/** guildCreate/guildDelete: the guild is unavailable because of an outage. In guildDelete, false means the bot was removed. */
|
|
48
|
-
unavailable: boolean;
|
|
49
|
-
rateLimit: APIRateLimitedEvent;
|
|
50
|
-
permissions: GatewayObject;
|
|
51
|
-
rule: GatewayObject;
|
|
52
|
-
execution: GatewayObject;
|
|
53
|
-
entry: GatewayObject;
|
|
54
|
-
emojis: GatewayObject[];
|
|
55
|
-
stickers: GatewayObject[];
|
|
56
|
-
scheduledEvent: GatewayObject;
|
|
57
|
-
sound: GatewayObject;
|
|
58
|
-
sounds: GatewayObject[];
|
|
59
|
-
integration: GatewayObject;
|
|
60
|
-
invite: GatewayObject;
|
|
61
|
-
voiceState: GatewayObject;
|
|
62
|
-
voiceServer: GatewayObject;
|
|
63
|
-
effect: GatewayObject;
|
|
64
|
-
stageInstance: GatewayObject;
|
|
65
|
-
presence: GatewayObject;
|
|
66
|
-
entitlement: GatewayObject;
|
|
67
|
-
subscription: GatewayObject;
|
|
68
|
-
threadMember: GatewayObject;
|
|
69
|
-
channels: GatewayObject[];
|
|
70
|
-
}
|
|
71
|
-
/** Builds the context of one event, shared by all its handlers. */
|
|
72
|
-
export declare function createContext(name: EventName, client: Client, data: unknown): EventContext;
|
package/dist/context.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { Channel } from './structures/Channel.js';
|
|
2
|
-
import { Guild } from './structures/Guild.js';
|
|
3
|
-
import { Interaction } from './structures/Interaction.js';
|
|
4
|
-
import { Member } from './structures/Member.js';
|
|
5
|
-
import { Message } from './structures/Message.js';
|
|
6
|
-
import { Reaction } from './structures/Reaction.js';
|
|
7
|
-
import { Role } from './structures/Role.js';
|
|
8
|
-
import { User } from './structures/User.js';
|
|
9
|
-
/** Every key, to tell a key missing from this event apart from a typo. */
|
|
10
|
-
const CONTEXT_KEYS = {
|
|
11
|
-
client: true,
|
|
12
|
-
data: true,
|
|
13
|
-
user: true,
|
|
14
|
-
member: true,
|
|
15
|
-
members: true,
|
|
16
|
-
message: true,
|
|
17
|
-
guild: true,
|
|
18
|
-
guilds: true,
|
|
19
|
-
channel: true,
|
|
20
|
-
thread: true,
|
|
21
|
-
threads: true,
|
|
22
|
-
role: true,
|
|
23
|
-
interaction: true,
|
|
24
|
-
reaction: true,
|
|
25
|
-
messageId: true,
|
|
26
|
-
messageIds: true,
|
|
27
|
-
userId: true,
|
|
28
|
-
roleId: true,
|
|
29
|
-
scheduledEventId: true,
|
|
30
|
-
soundId: true,
|
|
31
|
-
integrationId: true,
|
|
32
|
-
answerId: true,
|
|
33
|
-
code: true,
|
|
34
|
-
emoji: true,
|
|
35
|
-
unavailable: true,
|
|
36
|
-
rateLimit: true,
|
|
37
|
-
permissions: true,
|
|
38
|
-
rule: true,
|
|
39
|
-
execution: true,
|
|
40
|
-
entry: true,
|
|
41
|
-
emojis: true,
|
|
42
|
-
stickers: true,
|
|
43
|
-
scheduledEvent: true,
|
|
44
|
-
sound: true,
|
|
45
|
-
sounds: true,
|
|
46
|
-
integration: true,
|
|
47
|
-
invite: true,
|
|
48
|
-
voiceState: true,
|
|
49
|
-
voiceServer: true,
|
|
50
|
-
effect: true,
|
|
51
|
-
stageInstance: true,
|
|
52
|
-
presence: true,
|
|
53
|
-
entitlement: true,
|
|
54
|
-
subscription: true,
|
|
55
|
-
threadMember: true,
|
|
56
|
-
channels: true,
|
|
57
|
-
};
|
|
58
|
-
const guildOf = (client, data) => new Guild(client, { id: data.guild_id });
|
|
59
|
-
/** Channel known by id, with its guild when the event says it. */
|
|
60
|
-
const channelOf = (client, id, guildId) => new Channel(client, { id, ...(guildId && { guild_id: guildId }) });
|
|
61
|
-
const inGuild = (build = () => ({})) => (client, data) => ({ guild: guildOf(client, data), ...build(client, data) });
|
|
62
|
-
const message = (client, data) => {
|
|
63
|
-
const message = new Message(client, data);
|
|
64
|
-
return { message, channel: message.channel };
|
|
65
|
-
};
|
|
66
|
-
const reaction = (client, data) => ({
|
|
67
|
-
reaction: new Reaction(client, data),
|
|
68
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
69
|
-
messageId: data.message_id,
|
|
70
|
-
userId: data.user_id,
|
|
71
|
-
});
|
|
72
|
-
const pollVote = (client, data) => ({
|
|
73
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
74
|
-
messageId: data.message_id,
|
|
75
|
-
userId: data.user_id,
|
|
76
|
-
answerId: data.answer_id,
|
|
77
|
-
});
|
|
78
|
-
const member = inGuild((client, data) => {
|
|
79
|
-
const member = new Member(client, data.guild_id, data);
|
|
80
|
-
return { member, user: member.user };
|
|
81
|
-
});
|
|
82
|
-
const user = (key) => (client, data) => ({
|
|
83
|
-
user: new User(client, data[key]),
|
|
84
|
-
});
|
|
85
|
-
// Payloads: https://docs.discord.com/developers/events/gateway-events#receive-events
|
|
86
|
-
const BUILDERS = {
|
|
87
|
-
ready: (client, data) => ({
|
|
88
|
-
user: new User(client, data.user),
|
|
89
|
-
guilds: data.guilds.map((guild) => new Guild(client, guild)),
|
|
90
|
-
}),
|
|
91
|
-
resumed: () => ({}),
|
|
92
|
-
rateLimited: (_, data) => ({ rateLimit: data }),
|
|
93
|
-
applicationCommandPermissionsUpdate: inGuild((_, data) => ({
|
|
94
|
-
permissions: data,
|
|
95
|
-
})),
|
|
96
|
-
autoModerationRuleCreate: inGuild((_, data) => ({ rule: data })),
|
|
97
|
-
autoModerationRuleUpdate: inGuild((_, data) => ({ rule: data })),
|
|
98
|
-
autoModerationRuleDelete: inGuild((_, data) => ({ rule: data })),
|
|
99
|
-
autoModerationActionExecution: inGuild((_, data) => ({
|
|
100
|
-
execution: data,
|
|
101
|
-
userId: data.user_id,
|
|
102
|
-
})),
|
|
103
|
-
channelCreate: inGuild((client, data) => ({
|
|
104
|
-
channel: new Channel(client, data),
|
|
105
|
-
})),
|
|
106
|
-
channelUpdate: inGuild((client, data) => ({
|
|
107
|
-
channel: new Channel(client, data),
|
|
108
|
-
})),
|
|
109
|
-
channelDelete: inGuild((client, data) => ({
|
|
110
|
-
channel: new Channel(client, data),
|
|
111
|
-
})),
|
|
112
|
-
channelInfo: inGuild((_, data) => ({ channels: data.channels })),
|
|
113
|
-
channelPinsUpdate: (client, data) => ({
|
|
114
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
115
|
-
}),
|
|
116
|
-
voiceChannelStatusUpdate: inGuild((client, data) => ({
|
|
117
|
-
channel: channelOf(client, data.id, data.guild_id),
|
|
118
|
-
})),
|
|
119
|
-
voiceChannelStartTimeUpdate: inGuild((client, data) => ({
|
|
120
|
-
channel: channelOf(client, data.id, data.guild_id),
|
|
121
|
-
})),
|
|
122
|
-
threadCreate: inGuild((client, data) => ({
|
|
123
|
-
thread: new Channel(client, data),
|
|
124
|
-
})),
|
|
125
|
-
threadUpdate: inGuild((client, data) => ({
|
|
126
|
-
thread: new Channel(client, data),
|
|
127
|
-
})),
|
|
128
|
-
threadDelete: inGuild((client, data) => ({
|
|
129
|
-
thread: new Channel(client, data),
|
|
130
|
-
})),
|
|
131
|
-
threadListSync: inGuild((client, data) => ({
|
|
132
|
-
threads: data.threads.map((thread) => new Channel(client, thread)),
|
|
133
|
-
})),
|
|
134
|
-
threadMemberUpdate: inGuild((_, data) => ({ threadMember: data })),
|
|
135
|
-
threadMembersUpdate: inGuild((client, data) => ({
|
|
136
|
-
thread: channelOf(client, data.id, data.guild_id),
|
|
137
|
-
})),
|
|
138
|
-
entitlementCreate: (_, data) => ({ entitlement: data }),
|
|
139
|
-
entitlementUpdate: (_, data) => ({ entitlement: data }),
|
|
140
|
-
entitlementDelete: (_, data) => ({ entitlement: data }),
|
|
141
|
-
guildCreate: (client, data) => ({
|
|
142
|
-
guild: new Guild(client, data),
|
|
143
|
-
unavailable: data.unavailable === true,
|
|
144
|
-
}),
|
|
145
|
-
guildUpdate: (client, data) => ({ guild: new Guild(client, data) }),
|
|
146
|
-
guildDelete: (client, data) => ({
|
|
147
|
-
guild: new Guild(client, data),
|
|
148
|
-
unavailable: data.unavailable === true,
|
|
149
|
-
}),
|
|
150
|
-
guildAuditLogEntryCreate: inGuild((_, data) => ({ entry: data })),
|
|
151
|
-
guildBanAdd: inGuild(user('user')),
|
|
152
|
-
guildBanRemove: inGuild(user('user')),
|
|
153
|
-
guildEmojisUpdate: inGuild((_, data) => ({ emojis: data.emojis })),
|
|
154
|
-
guildStickersUpdate: inGuild((_, data) => ({ stickers: data.stickers })),
|
|
155
|
-
guildIntegrationsUpdate: inGuild(),
|
|
156
|
-
guildMemberAdd: member,
|
|
157
|
-
guildMemberRemove: inGuild(user('user')),
|
|
158
|
-
guildMemberUpdate: member,
|
|
159
|
-
guildMembersChunk: inGuild((client, data) => ({
|
|
160
|
-
members: data.members.map((member) => new Member(client, data.guild_id, member)),
|
|
161
|
-
})),
|
|
162
|
-
guildRoleCreate: inGuild((client, data) => ({
|
|
163
|
-
role: new Role(client, data.guild_id, data.role),
|
|
164
|
-
})),
|
|
165
|
-
guildRoleUpdate: inGuild((client, data) => ({
|
|
166
|
-
role: new Role(client, data.guild_id, data.role),
|
|
167
|
-
})),
|
|
168
|
-
guildRoleDelete: inGuild((_, data) => ({ roleId: data.role_id })),
|
|
169
|
-
guildScheduledEventCreate: inGuild((_, data) => ({ scheduledEvent: data })),
|
|
170
|
-
guildScheduledEventUpdate: inGuild((_, data) => ({ scheduledEvent: data })),
|
|
171
|
-
guildScheduledEventDelete: inGuild((_, data) => ({ scheduledEvent: data })),
|
|
172
|
-
guildScheduledEventUserAdd: inGuild((_, data) => ({
|
|
173
|
-
userId: data.user_id,
|
|
174
|
-
scheduledEventId: data.guild_scheduled_event_id,
|
|
175
|
-
})),
|
|
176
|
-
guildScheduledEventUserRemove: inGuild((_, data) => ({
|
|
177
|
-
userId: data.user_id,
|
|
178
|
-
scheduledEventId: data.guild_scheduled_event_id,
|
|
179
|
-
})),
|
|
180
|
-
guildSoundboardSoundCreate: inGuild((_, data) => ({ sound: data })),
|
|
181
|
-
guildSoundboardSoundUpdate: inGuild((_, data) => ({ sound: data })),
|
|
182
|
-
guildSoundboardSoundDelete: inGuild((_, data) => ({
|
|
183
|
-
soundId: data.sound_id,
|
|
184
|
-
})),
|
|
185
|
-
guildSoundboardSoundsUpdate: inGuild((_, data) => ({
|
|
186
|
-
sounds: data.soundboard_sounds,
|
|
187
|
-
})),
|
|
188
|
-
soundboardSounds: inGuild((_, data) => ({ sounds: data.soundboard_sounds })),
|
|
189
|
-
integrationCreate: inGuild((_, data) => ({ integration: data })),
|
|
190
|
-
integrationUpdate: inGuild((_, data) => ({ integration: data })),
|
|
191
|
-
integrationDelete: inGuild((_, data) => ({ integrationId: data.id })),
|
|
192
|
-
interactionCreate: (client, data) => ({
|
|
193
|
-
interaction: new Interaction(client, data),
|
|
194
|
-
}),
|
|
195
|
-
inviteCreate: (client, data) => ({
|
|
196
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
197
|
-
invite: data,
|
|
198
|
-
}),
|
|
199
|
-
inviteDelete: (client, data) => ({
|
|
200
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
201
|
-
code: data.code,
|
|
202
|
-
}),
|
|
203
|
-
messageCreate: message,
|
|
204
|
-
messageUpdate: message,
|
|
205
|
-
messageDelete: (client, data) => ({
|
|
206
|
-
messageId: data.id,
|
|
207
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
208
|
-
}),
|
|
209
|
-
messageDeleteBulk: (client, data) => ({
|
|
210
|
-
messageIds: data.ids,
|
|
211
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
212
|
-
}),
|
|
213
|
-
messageReactionAdd: reaction,
|
|
214
|
-
messageReactionRemove: reaction,
|
|
215
|
-
messageReactionRemoveAll: (client, data) => ({
|
|
216
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
217
|
-
messageId: data.message_id,
|
|
218
|
-
}),
|
|
219
|
-
messageReactionRemoveEmoji: (client, data) => ({
|
|
220
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
221
|
-
messageId: data.message_id,
|
|
222
|
-
emoji: data.emoji,
|
|
223
|
-
}),
|
|
224
|
-
// The user object can be partial, only its id is guaranteed
|
|
225
|
-
presenceUpdate: inGuild((_, data) => ({
|
|
226
|
-
userId: data.user.id,
|
|
227
|
-
presence: data,
|
|
228
|
-
})),
|
|
229
|
-
stageInstanceCreate: inGuild((_, data) => ({ stageInstance: data })),
|
|
230
|
-
stageInstanceUpdate: inGuild((_, data) => ({ stageInstance: data })),
|
|
231
|
-
stageInstanceDelete: inGuild((_, data) => ({ stageInstance: data })),
|
|
232
|
-
subscriptionCreate: (_, data) => ({ subscription: data }),
|
|
233
|
-
subscriptionUpdate: (_, data) => ({ subscription: data }),
|
|
234
|
-
subscriptionDelete: (_, data) => ({ subscription: data }),
|
|
235
|
-
typingStart: (client, data) => ({
|
|
236
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
237
|
-
userId: data.user_id,
|
|
238
|
-
}),
|
|
239
|
-
userUpdate: (client, data) => ({ user: new User(client, data) }),
|
|
240
|
-
voiceChannelEffectSend: inGuild((client, data) => ({
|
|
241
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
242
|
-
userId: data.user_id,
|
|
243
|
-
effect: data,
|
|
244
|
-
})),
|
|
245
|
-
voiceStateUpdate: (_, data) => ({ userId: data.user_id, voiceState: data }),
|
|
246
|
-
voiceServerUpdate: inGuild((_, data) => ({ voiceServer: data })),
|
|
247
|
-
webhooksUpdate: inGuild((client, data) => ({
|
|
248
|
-
channel: channelOf(client, data.channel_id, data.guild_id),
|
|
249
|
-
})),
|
|
250
|
-
messagePollVoteAdd: pollVote,
|
|
251
|
-
messagePollVoteRemove: pollVote,
|
|
252
|
-
};
|
|
253
|
-
/** Builds the context of one event, shared by all its handlers. */
|
|
254
|
-
export function createContext(name, client, data) {
|
|
255
|
-
const values = {
|
|
256
|
-
client,
|
|
257
|
-
data,
|
|
258
|
-
...BUILDERS[name](client, data),
|
|
259
|
-
};
|
|
260
|
-
return new Proxy(values, {
|
|
261
|
-
get(target, key) {
|
|
262
|
-
if (typeof key !== 'string' || Object.hasOwn(target, key))
|
|
263
|
-
return Reflect.get(target, key);
|
|
264
|
-
if (Object.hasOwn(CONTEXT_KEYS, key)) {
|
|
265
|
-
const hint = key === 'guild' && ('message' in target || 'channel' in target)
|
|
266
|
-
? ` For the server, use ${'message' in target ? 'message' : 'channel'}.guild (null in DMs).`
|
|
267
|
-
: '';
|
|
268
|
-
throw new Error(`"${key}" doesn't exist in ${name} events. You can use: ${Object.keys(target).join(', ')}.${hint}`);
|
|
269
|
-
}
|
|
270
|
-
return undefined;
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
}
|
package/dist/discord/client.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Gateway } from './gateway.js';
|
|
2
|
-
import type { RestClient } from './rest.js';
|
|
3
|
-
import { Channel } from '../structures/Channel.js';
|
|
4
|
-
import { Guild } from '../structures/Guild.js';
|
|
5
|
-
import { User } from '../structures/User.js';
|
|
6
|
-
import type { Snowflake } from './types.js';
|
|
7
|
-
/**
|
|
8
|
-
* What handlers, buttons and presence functions receive as `client`. It reads
|
|
9
|
-
* the connection state and acts on Discord, but can't drive the connection:
|
|
10
|
-
* logging in, intents, presence and shutdown belong to the framework.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Client {
|
|
13
|
-
#private;
|
|
14
|
-
/** Created by the framework, use the `client` passed to your handlers. */
|
|
15
|
-
private constructor();
|
|
16
|
-
/** REST client, to call endpoints not wrapped by the framework. */
|
|
17
|
-
get rest(): RestClient;
|
|
18
|
-
/** The bot's user, set once connected. */
|
|
19
|
-
get user(): User | null;
|
|
20
|
-
get applicationId(): string | null;
|
|
21
|
-
/** Ids of the guilds the bot is in, as sent in READY. */
|
|
22
|
-
get guildIds(): ReadonlySet<string>;
|
|
23
|
-
/** Bitfield of the gateway intents of the current session. */
|
|
24
|
-
get intents(): number;
|
|
25
|
-
/** A channel by id, to send messages or fetch it without fetching it first. */
|
|
26
|
-
channel(id: Snowflake): Channel;
|
|
27
|
-
/** A server by id, to fetch members, ban… without fetching it first. */
|
|
28
|
-
guild(id: Snowflake): Guild;
|
|
29
|
-
/** https://docs.discord.com/developers/resources/user#get-user */
|
|
30
|
-
fetchUser(id: Snowflake): Promise<User>;
|
|
31
|
-
}
|
|
32
|
-
/** Internal: the client of a gateway. */
|
|
33
|
-
export declare const createClient: (gateway: Gateway) => Client;
|
|
34
|
-
/** Internal: a message for the user, printed by `chapterjs dev`. */
|
|
35
|
-
export declare function emitWarning(client: Client, message: string): void;
|
package/dist/discord/client.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Channel } from '../structures/Channel.js';
|
|
2
|
-
import { Guild } from '../structures/Guild.js';
|
|
3
|
-
import { User } from '../structures/User.js';
|
|
4
|
-
/** Proves a `Client` is created by the framework, not by user code. */
|
|
5
|
-
const INTERNAL = Symbol('chapterjs.client');
|
|
6
|
-
let gatewayOf;
|
|
7
|
-
let construct;
|
|
8
|
-
/**
|
|
9
|
-
* What handlers, buttons and presence functions receive as `client`. It reads
|
|
10
|
-
* the connection state and acts on Discord, but can't drive the connection:
|
|
11
|
-
* logging in, intents, presence and shutdown belong to the framework.
|
|
12
|
-
*/
|
|
13
|
-
export class Client {
|
|
14
|
-
#gateway;
|
|
15
|
-
static {
|
|
16
|
-
gatewayOf = client => client.#gateway;
|
|
17
|
-
construct = gateway => new Client(INTERNAL, gateway);
|
|
18
|
-
}
|
|
19
|
-
/** Created by the framework, use the `client` passed to your handlers. */
|
|
20
|
-
constructor(key, gateway) {
|
|
21
|
-
if (key !== INTERNAL) {
|
|
22
|
-
throw new TypeError('Client is created by ChapterJS: use the `client` passed to your handlers.');
|
|
23
|
-
}
|
|
24
|
-
this.#gateway = gateway;
|
|
25
|
-
Object.freeze(this);
|
|
26
|
-
}
|
|
27
|
-
/** REST client, to call endpoints not wrapped by the framework. */
|
|
28
|
-
get rest() {
|
|
29
|
-
return this.#gateway.rest;
|
|
30
|
-
}
|
|
31
|
-
/** The bot's user, set once connected. */
|
|
32
|
-
get user() {
|
|
33
|
-
return this.#gateway.user;
|
|
34
|
-
}
|
|
35
|
-
get applicationId() {
|
|
36
|
-
return this.#gateway.applicationId;
|
|
37
|
-
}
|
|
38
|
-
/** Ids of the guilds the bot is in, as sent in READY. */
|
|
39
|
-
get guildIds() {
|
|
40
|
-
return new Set(this.#gateway.guildIds);
|
|
41
|
-
}
|
|
42
|
-
/** Bitfield of the gateway intents of the current session. */
|
|
43
|
-
get intents() {
|
|
44
|
-
return this.#gateway.intents;
|
|
45
|
-
}
|
|
46
|
-
/** A channel by id, to send messages or fetch it without fetching it first. */
|
|
47
|
-
channel(id) {
|
|
48
|
-
return new Channel(this, { id });
|
|
49
|
-
}
|
|
50
|
-
/** A server by id, to fetch members, ban… without fetching it first. */
|
|
51
|
-
guild(id) {
|
|
52
|
-
return new Guild(this, { id });
|
|
53
|
-
}
|
|
54
|
-
/** https://docs.discord.com/developers/resources/user#get-user */
|
|
55
|
-
async fetchUser(id) {
|
|
56
|
-
return new User(this, await this.rest.get(`/users/${id}`));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
Object.freeze(Client);
|
|
60
|
-
Object.freeze(Client.prototype);
|
|
61
|
-
/** Internal: the client of a gateway. */
|
|
62
|
-
export const createClient = (gateway) => construct(gateway);
|
|
63
|
-
/** Internal: a message for the user, printed by `chapterjs dev`. */
|
|
64
|
-
export function emitWarning(client, message) {
|
|
65
|
-
gatewayOf(client).emit('warning', message);
|
|
66
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export declare const API_VERSION = 10;
|
|
2
|
-
export declare const API_BASE_URL = "https://discord.com/api/v10";
|
|
3
|
-
export declare const GatewayOpcodes: {
|
|
4
|
-
readonly Dispatch: 0;
|
|
5
|
-
readonly Heartbeat: 1;
|
|
6
|
-
readonly Identify: 2;
|
|
7
|
-
readonly PresenceUpdate: 3;
|
|
8
|
-
readonly Resume: 6;
|
|
9
|
-
readonly Reconnect: 7;
|
|
10
|
-
readonly InvalidSession: 9;
|
|
11
|
-
readonly Hello: 10;
|
|
12
|
-
readonly HeartbeatAck: 11;
|
|
13
|
-
};
|
|
14
|
-
export declare const GatewayCloseCodes: {
|
|
15
|
-
readonly AuthenticationFailed: 4004;
|
|
16
|
-
readonly InvalidSeq: 4007;
|
|
17
|
-
readonly SessionTimedOut: 4009;
|
|
18
|
-
readonly InvalidShard: 4010;
|
|
19
|
-
readonly ShardingRequired: 4011;
|
|
20
|
-
readonly InvalidApiVersion: 4012;
|
|
21
|
-
readonly InvalidIntents: 4013;
|
|
22
|
-
readonly DisallowedIntents: 4014;
|
|
23
|
-
};
|
|
24
|
-
/** Close codes after which reconnecting is pointless. */
|
|
25
|
-
export declare const INVALID_TOKEN_MESSAGE: string;
|
|
26
|
-
export declare const FATAL_CLOSE_CODES: Record<number, string>;
|
|
27
|
-
export declare const GatewayIntents: {
|
|
28
|
-
readonly Guilds: number;
|
|
29
|
-
readonly GuildMembers: number;
|
|
30
|
-
readonly GuildModeration: number;
|
|
31
|
-
readonly GuildExpressions: number;
|
|
32
|
-
readonly GuildIntegrations: number;
|
|
33
|
-
readonly GuildWebhooks: number;
|
|
34
|
-
readonly GuildInvites: number;
|
|
35
|
-
readonly GuildVoiceStates: number;
|
|
36
|
-
readonly GuildPresences: number;
|
|
37
|
-
readonly GuildMessages: number;
|
|
38
|
-
readonly GuildMessageReactions: number;
|
|
39
|
-
readonly GuildMessageTyping: number;
|
|
40
|
-
readonly DirectMessages: number;
|
|
41
|
-
readonly DirectMessageReactions: number;
|
|
42
|
-
readonly DirectMessageTyping: number;
|
|
43
|
-
readonly MessageContent: number;
|
|
44
|
-
readonly GuildScheduledEvents: number;
|
|
45
|
-
readonly AutoModerationConfiguration: number;
|
|
46
|
-
readonly AutoModerationExecution: number;
|
|
47
|
-
readonly GuildMessagePolls: number;
|
|
48
|
-
readonly DirectMessagePolls: number;
|
|
49
|
-
};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
// https://docs.discord.com/developers/reference#api-versioning
|
|
2
|
-
export const API_VERSION = 10;
|
|
3
|
-
export const API_BASE_URL = `https://discord.com/api/v${API_VERSION}`;
|
|
4
|
-
// https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-opcodes
|
|
5
|
-
export const GatewayOpcodes = {
|
|
6
|
-
Dispatch: 0,
|
|
7
|
-
Heartbeat: 1,
|
|
8
|
-
Identify: 2,
|
|
9
|
-
PresenceUpdate: 3,
|
|
10
|
-
Resume: 6,
|
|
11
|
-
Reconnect: 7,
|
|
12
|
-
InvalidSession: 9,
|
|
13
|
-
Hello: 10,
|
|
14
|
-
HeartbeatAck: 11,
|
|
15
|
-
};
|
|
16
|
-
// https://docs.discord.com/developers/topics/opcodes-and-status-codes#gateway-gateway-close-event-codes
|
|
17
|
-
export const GatewayCloseCodes = {
|
|
18
|
-
AuthenticationFailed: 4004,
|
|
19
|
-
InvalidSeq: 4007,
|
|
20
|
-
SessionTimedOut: 4009,
|
|
21
|
-
InvalidShard: 4010,
|
|
22
|
-
ShardingRequired: 4011,
|
|
23
|
-
InvalidApiVersion: 4012,
|
|
24
|
-
InvalidIntents: 4013,
|
|
25
|
-
DisallowedIntents: 4014,
|
|
26
|
-
};
|
|
27
|
-
/** Close codes after which reconnecting is pointless. */
|
|
28
|
-
export const INVALID_TOKEN_MESSAGE = 'Discord refused the bot token: check BOT_TOKEN in your .env file. ' +
|
|
29
|
-
'If it was reset or leaked, get a new one in the Developer Portal (your application > Bot > Reset Token).';
|
|
30
|
-
export const FATAL_CLOSE_CODES = {
|
|
31
|
-
[GatewayCloseCodes.AuthenticationFailed]: INVALID_TOKEN_MESSAGE,
|
|
32
|
-
[GatewayCloseCodes.InvalidShard]: 'Invalid shard.',
|
|
33
|
-
[GatewayCloseCodes.ShardingRequired]: 'Discord requires sharding for this bot (it is in too many servers), which ChapterJS does not support yet.',
|
|
34
|
-
[GatewayCloseCodes.InvalidApiVersion]: `Discord no longer supports the gateway API v${API_VERSION}: update chapterjs.`,
|
|
35
|
-
[GatewayCloseCodes.InvalidIntents]: 'Discord refused the intents sent by ChapterJS.',
|
|
36
|
-
[GatewayCloseCodes.DisallowedIntents]: 'Discord refused to connect: your code asks for privileged intents that are not enabled for this bot.',
|
|
37
|
-
};
|
|
38
|
-
// https://docs.discord.com/developers/events/gateway#list-of-intents
|
|
39
|
-
export const GatewayIntents = {
|
|
40
|
-
Guilds: 1 << 0,
|
|
41
|
-
GuildMembers: 1 << 1,
|
|
42
|
-
GuildModeration: 1 << 2,
|
|
43
|
-
GuildExpressions: 1 << 3,
|
|
44
|
-
GuildIntegrations: 1 << 4,
|
|
45
|
-
GuildWebhooks: 1 << 5,
|
|
46
|
-
GuildInvites: 1 << 6,
|
|
47
|
-
GuildVoiceStates: 1 << 7,
|
|
48
|
-
GuildPresences: 1 << 8,
|
|
49
|
-
GuildMessages: 1 << 9,
|
|
50
|
-
GuildMessageReactions: 1 << 10,
|
|
51
|
-
GuildMessageTyping: 1 << 11,
|
|
52
|
-
DirectMessages: 1 << 12,
|
|
53
|
-
DirectMessageReactions: 1 << 13,
|
|
54
|
-
DirectMessageTyping: 1 << 14,
|
|
55
|
-
MessageContent: 1 << 15,
|
|
56
|
-
GuildScheduledEvents: 1 << 16,
|
|
57
|
-
AutoModerationConfiguration: 1 << 20,
|
|
58
|
-
AutoModerationExecution: 1 << 21,
|
|
59
|
-
GuildMessagePolls: 1 << 24,
|
|
60
|
-
DirectMessagePolls: 1 << 25,
|
|
61
|
-
};
|
package/dist/discord/events.d.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import type { GatewayObject, APIGuild, APIGuildBanEvent, APIGuildCreateEvent, APIGuildMemberAddEvent, APIGuildMemberRemoveEvent, APIGuildMemberUpdateEvent, APIInteraction, APIMessage, APIMessageDeleteBulkEvent, APIMessageDeleteEvent, APIMessageReactionAddEvent, APIMessageReactionRemoveAllEvent, APIMessageReactionRemoveEmojiEvent, APIMessageReactionRemoveEvent, APIRateLimitedEvent, APIReadyEvent, APITypingStartEvent, APIUnavailableGuild, APIUser } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Every dispatch event an app can receive, by camelCase name, with the intents
|
|
4
|
-
* that make Discord send it (0 when it is always sent). An event listed under
|
|
5
|
-
* several intents (guild and DM) needs any of them; all are requested.
|
|
6
|
-
*
|
|
7
|
-
* https://docs.discord.com/developers/events/gateway-events#receive-events
|
|
8
|
-
* https://docs.discord.com/developers/events/gateway#list-of-intents
|
|
9
|
-
*/
|
|
10
|
-
export declare const GATEWAY_EVENTS: {
|
|
11
|
-
readonly ready: 0;
|
|
12
|
-
readonly resumed: 0;
|
|
13
|
-
readonly rateLimited: 0;
|
|
14
|
-
readonly applicationCommandPermissionsUpdate: 0;
|
|
15
|
-
readonly autoModerationRuleCreate: number;
|
|
16
|
-
readonly autoModerationRuleUpdate: number;
|
|
17
|
-
readonly autoModerationRuleDelete: number;
|
|
18
|
-
readonly autoModerationActionExecution: number;
|
|
19
|
-
readonly channelCreate: number;
|
|
20
|
-
readonly channelUpdate: number;
|
|
21
|
-
readonly channelDelete: number;
|
|
22
|
-
readonly channelInfo: 0;
|
|
23
|
-
readonly channelPinsUpdate: number;
|
|
24
|
-
readonly voiceChannelStatusUpdate: number;
|
|
25
|
-
readonly voiceChannelStartTimeUpdate: number;
|
|
26
|
-
readonly threadCreate: number;
|
|
27
|
-
readonly threadUpdate: number;
|
|
28
|
-
readonly threadDelete: number;
|
|
29
|
-
readonly threadListSync: number;
|
|
30
|
-
readonly threadMemberUpdate: number;
|
|
31
|
-
readonly threadMembersUpdate: number;
|
|
32
|
-
readonly entitlementCreate: 0;
|
|
33
|
-
readonly entitlementUpdate: 0;
|
|
34
|
-
readonly entitlementDelete: 0;
|
|
35
|
-
readonly guildCreate: number;
|
|
36
|
-
readonly guildUpdate: number;
|
|
37
|
-
readonly guildDelete: number;
|
|
38
|
-
readonly guildAuditLogEntryCreate: number;
|
|
39
|
-
readonly guildBanAdd: number;
|
|
40
|
-
readonly guildBanRemove: number;
|
|
41
|
-
readonly guildEmojisUpdate: number;
|
|
42
|
-
readonly guildStickersUpdate: number;
|
|
43
|
-
readonly guildIntegrationsUpdate: number;
|
|
44
|
-
readonly guildMemberAdd: number;
|
|
45
|
-
readonly guildMemberRemove: number;
|
|
46
|
-
readonly guildMemberUpdate: number;
|
|
47
|
-
readonly guildMembersChunk: 0;
|
|
48
|
-
readonly guildRoleCreate: number;
|
|
49
|
-
readonly guildRoleUpdate: number;
|
|
50
|
-
readonly guildRoleDelete: number;
|
|
51
|
-
readonly guildScheduledEventCreate: number;
|
|
52
|
-
readonly guildScheduledEventUpdate: number;
|
|
53
|
-
readonly guildScheduledEventDelete: number;
|
|
54
|
-
readonly guildScheduledEventUserAdd: number;
|
|
55
|
-
readonly guildScheduledEventUserRemove: number;
|
|
56
|
-
readonly guildSoundboardSoundCreate: number;
|
|
57
|
-
readonly guildSoundboardSoundUpdate: number;
|
|
58
|
-
readonly guildSoundboardSoundDelete: number;
|
|
59
|
-
readonly guildSoundboardSoundsUpdate: number;
|
|
60
|
-
readonly soundboardSounds: 0;
|
|
61
|
-
readonly integrationCreate: number;
|
|
62
|
-
readonly integrationUpdate: number;
|
|
63
|
-
readonly integrationDelete: number;
|
|
64
|
-
readonly interactionCreate: 0;
|
|
65
|
-
readonly inviteCreate: number;
|
|
66
|
-
readonly inviteDelete: number;
|
|
67
|
-
readonly messageCreate: number;
|
|
68
|
-
readonly messageUpdate: number;
|
|
69
|
-
readonly messageDelete: number;
|
|
70
|
-
readonly messageDeleteBulk: number;
|
|
71
|
-
readonly messageReactionAdd: number;
|
|
72
|
-
readonly messageReactionRemove: number;
|
|
73
|
-
readonly messageReactionRemoveAll: number;
|
|
74
|
-
readonly messageReactionRemoveEmoji: number;
|
|
75
|
-
readonly presenceUpdate: number;
|
|
76
|
-
readonly stageInstanceCreate: number;
|
|
77
|
-
readonly stageInstanceUpdate: number;
|
|
78
|
-
readonly stageInstanceDelete: number;
|
|
79
|
-
readonly subscriptionCreate: 0;
|
|
80
|
-
readonly subscriptionUpdate: 0;
|
|
81
|
-
readonly subscriptionDelete: 0;
|
|
82
|
-
readonly typingStart: number;
|
|
83
|
-
readonly userUpdate: 0;
|
|
84
|
-
readonly voiceChannelEffectSend: number;
|
|
85
|
-
readonly voiceStateUpdate: number;
|
|
86
|
-
readonly voiceServerUpdate: 0;
|
|
87
|
-
readonly webhooksUpdate: number;
|
|
88
|
-
readonly messagePollVoteAdd: number;
|
|
89
|
-
readonly messagePollVoteRemove: number;
|
|
90
|
-
};
|
|
91
|
-
export type EventName = keyof typeof GATEWAY_EVENTS;
|
|
92
|
-
/** Data of the events typed in detail; the others receive a plain object. */
|
|
93
|
-
interface TypedEventData {
|
|
94
|
-
ready: APIReadyEvent;
|
|
95
|
-
resumed: unknown;
|
|
96
|
-
rateLimited: APIRateLimitedEvent;
|
|
97
|
-
guildCreate: APIGuildCreateEvent;
|
|
98
|
-
guildUpdate: APIGuild;
|
|
99
|
-
/** `unavailable` is not set when the bot was removed from the guild. */
|
|
100
|
-
guildDelete: APIUnavailableGuild;
|
|
101
|
-
guildBanAdd: APIGuildBanEvent;
|
|
102
|
-
guildBanRemove: APIGuildBanEvent;
|
|
103
|
-
guildMemberAdd: APIGuildMemberAddEvent;
|
|
104
|
-
guildMemberRemove: APIGuildMemberRemoveEvent;
|
|
105
|
-
guildMemberUpdate: APIGuildMemberUpdateEvent;
|
|
106
|
-
interactionCreate: APIInteraction;
|
|
107
|
-
messageCreate: APIMessage;
|
|
108
|
-
/** Same shape as messageCreate; `tts` is always false. */
|
|
109
|
-
messageUpdate: APIMessage;
|
|
110
|
-
messageDelete: APIMessageDeleteEvent;
|
|
111
|
-
messageDeleteBulk: APIMessageDeleteBulkEvent;
|
|
112
|
-
messageReactionAdd: APIMessageReactionAddEvent;
|
|
113
|
-
messageReactionRemove: APIMessageReactionRemoveEvent;
|
|
114
|
-
messageReactionRemoveAll: APIMessageReactionRemoveAllEvent;
|
|
115
|
-
messageReactionRemoveEmoji: APIMessageReactionRemoveEmojiEvent;
|
|
116
|
-
typingStart: APITypingStartEvent;
|
|
117
|
-
userUpdate: APIUser;
|
|
118
|
-
}
|
|
119
|
-
/** Data received by the `E` event handlers. */
|
|
120
|
-
export type EventData<E extends EventName> = E extends keyof TypedEventData ? TypedEventData[E] : GatewayObject;
|
|
121
|
-
/** `messageCreate` → `MESSAGE_CREATE`, as sent by Discord. */
|
|
122
|
-
export declare function toDispatchName(name: EventName): string;
|
|
123
|
-
/** Intents only granted once enabled in the Developer Portal (Bot > Privileged Gateway Intents). */
|
|
124
|
-
export declare const PRIVILEGED_INTENTS: {
|
|
125
|
-
readonly GuildMembers: number;
|
|
126
|
-
readonly GuildPresences: number;
|
|
127
|
-
readonly MessageContent: number;
|
|
128
|
-
};
|
|
129
|
-
export {};
|