lunibee 0.1.8 β†’ 0.2.1

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.
Files changed (55) hide show
  1. package/README.md +2 -0
  2. package/dist/builders/components.d.ts +30 -2
  3. package/dist/builders/embed.d.ts +7 -7
  4. package/dist/builders/index.d.ts +1 -1
  5. package/dist/builders/index.js +110 -18
  6. package/dist/builders/index.js.map +6 -6
  7. package/dist/collection/index.d.ts +68 -1
  8. package/dist/collection/index.js +334 -1
  9. package/dist/collection/index.js.map +3 -3
  10. package/dist/core/collector.d.ts +13 -0
  11. package/dist/core/events.d.ts +29 -3
  12. package/dist/core/index.d.ts +25 -9
  13. package/dist/core/index.js +1745 -134
  14. package/dist/core/index.js.map +30 -26
  15. package/dist/core/permissions.d.ts +48 -0
  16. package/dist/index.js +2102 -362
  17. package/dist/index.js.map +36 -34
  18. package/dist/managers/advanced.d.ts +116 -0
  19. package/dist/managers/base.d.ts +13 -2
  20. package/dist/managers/emoji.d.ts +1 -1
  21. package/dist/managers/guild-resources.d.ts +22 -2
  22. package/dist/managers/guild.d.ts +31 -3
  23. package/dist/managers/index.d.ts +38 -6
  24. package/dist/managers/index.js +996 -160
  25. package/dist/managers/index.js.map +20 -18
  26. package/dist/managers/member.d.ts +13 -12
  27. package/dist/managers/message.d.ts +21 -4
  28. package/dist/rest/errors.d.ts +33 -0
  29. package/dist/rest/index.d.ts +1 -1
  30. package/dist/rest/index.js +52 -6
  31. package/dist/rest/index.js.map +5 -5
  32. package/dist/rest/routes.d.ts +20 -0
  33. package/dist/sharding/index.d.ts +29 -0
  34. package/dist/sharding/index.js +99 -15
  35. package/dist/sharding/index.js.map +8 -8
  36. package/dist/structures/base.d.ts +38 -0
  37. package/dist/structures/index.d.ts +29 -0
  38. package/dist/structures/index.js +208 -46
  39. package/dist/structures/index.js.map +13 -12
  40. package/dist/structures/interactions.d.ts +51 -1
  41. package/dist/structures/options.d.ts +2 -0
  42. package/dist/structures/resources.d.ts +29 -3
  43. package/dist/types/gateway.d.ts +16 -0
  44. package/dist/types/index.d.ts +67 -1
  45. package/dist/types/index.js.map +3 -3
  46. package/dist/utils/args.d.ts +79 -0
  47. package/dist/utils/index.d.ts +1 -0
  48. package/dist/utils/index.js +190 -2
  49. package/dist/utils/index.js.map +5 -4
  50. package/dist/voice/index.d.ts +3 -0
  51. package/dist/voice/index.js +15 -1
  52. package/dist/voice/index.js.map +3 -3
  53. package/dist/ws/index.js +13 -5
  54. package/dist/ws/index.js.map +6 -6
  55. package/package.json +14 -14
@@ -1,3 +1,5 @@
1
+ import { User, type ResourceContext } from "./base.js";
2
+ import { GuildMember } from "./resources.js";
1
3
  /** Discord interaction type constants. */
2
4
  export declare const InteractionType: {
3
5
  readonly Ping: 1;
@@ -34,6 +36,10 @@ export interface InteractionClient {
34
36
  /** Edits the original interaction response. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */ editInteractionReply(token: string, data: InteractionReplyOptions): Promise<unknown>;
35
37
  /** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */ deleteInteractionReply(token: string): Promise<void>;
36
38
  /** Sends a follow-up interaction webhook message. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */ followUpInteraction(token: string, data: InteractionReplyOptions): Promise<unknown>;
39
+ /** Reads, edits or deletes an interaction webhook message (`@original` or a follow-up ID). Optional; required for {@link Interaction.fetchReply}, {@link Interaction.editFollowUp} and {@link Interaction.deleteFollowUp}. */
40
+ interactionWebhookMessage?(method: "GET" | "PATCH" | "DELETE", applicationId: string, token: string, messageId: string, data?: InteractionReplyOptions): Promise<unknown>;
41
+ /** Lets structures built from an interaction (such as {@link Interaction.member}) act through the client. Optional. */
42
+ readonly resourceContext?: ResourceContext;
37
43
  }
38
44
  export { CommandOptions, type APIInteractionDataOption } from "./options.js";
39
45
  import { CommandOptions } from "./options.js";
@@ -65,6 +71,18 @@ export declare class Interaction<TData extends InteractionData = InteractionData
65
71
  /** Whether the initial response was deferred. */ deferred: boolean;
66
72
  /** Creates an interaction from a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @throws {TypeError} If required identifiers are missing. */ constructor(client: InteractionClient, data: TData);
67
73
  /** Whether this interaction is an application command. @returns True for application command interactions. */ isChatInputCommand(): this is CommandInteraction;
74
+ /**
75
+ * Waits for this user to submit a modal, typically one this interaction
76
+ * just opened with {@link showModal}.
77
+ * @param options `time` (required, ms); optional `customId` and `filter`.
78
+ * @returns The submission. @throws {Error} When time runs out first or no client is attached.
79
+ * @example const submitted = await interaction.awaitModalSubmit({ time: 60_000, customId: "feedback" });
80
+ */
81
+ awaitModalSubmit(options: {
82
+ time: number;
83
+ customId?: string;
84
+ filter?: (interaction: ModalSubmitInteraction) => boolean | Promise<boolean>;
85
+ }): Promise<ModalSubmitInteraction>;
68
86
  /** Whether this interaction is a message component. @returns True for component interactions. */ isMessageComponent(): this is ComponentInteraction;
69
87
  /** Whether this interaction is a modal submission. @returns True for modal submissions. */ isModalSubmit(): this is ModalSubmitInteraction;
70
88
  /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */ isAutocomplete(): this is AutocompleteInteraction;
@@ -76,17 +94,47 @@ export declare class Interaction<TData extends InteractionData = InteractionData
76
94
  /** Whether this is a channel select menu interaction. */ isChannelSelectMenu(): this is ComponentInteraction;
77
95
  /** Whether this is any select menu interaction. */ isAnySelectMenu(): this is ComponentInteraction;
78
96
  /** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */ protected assertUnacknowledged(): void;
97
+ /**
98
+ * Sends the initial response exactly once. The in-flight flag is set
99
+ * before the request, so two concurrent calls cannot both send; it is
100
+ * cleared if the request fails so the caller may try again.
101
+ */
102
+ protected acknowledge(response: InteractionResponse, state: "replied" | "deferred"): Promise<unknown>;
103
+ /** The invoking user (from `member.user` in guilds, `user` in DMs). */
104
+ get user(): User | null;
105
+ /** The invoking guild member, or null outside a guild. */
106
+ get member(): GuildMember | null;
107
+ /** Unix timestamp (ms) at which the interaction was created, from its snowflake. */
108
+ get createdTimestamp(): number;
109
+ /** When the interaction token stops working (15 minutes after creation). */
110
+ get expiresAt(): Date;
111
+ /** Whether the token has expired; no response, edit or follow-up can succeed after that. */
112
+ get isExpired(): boolean;
113
+ /** Fetches the original response message. */
114
+ fetchReply(): Promise<unknown>;
115
+ /** Edits a follow-up message. @param messageId Follow-up message ID. */
116
+ editFollowUp(messageId: string, options: InteractionReplyOptions | string): Promise<unknown>;
117
+ /** Deletes a follow-up message. @param messageId Follow-up message ID. */
118
+ deleteFollowUp(messageId: string): Promise<void>;
79
119
  /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
80
120
  /** Posts a raw interaction response callback. */
81
121
  protected postResponse(response: InteractionResponse): Promise<unknown>;
82
122
  /** Sends the initial interaction response. @param options Response message options. @returns Discord response. @throws {Error} When already acknowledged or REST fails. */ reply(options: InteractionReplyOptions | string): Promise<unknown>;
83
- /** Defers the initial interaction response. @param ephemeral Whether the eventual response is ephemeral. @returns Promise fulfilled after acknowledgement. @throws {Error} When already acknowledged or REST fails. */ deferReply(ephemeral?: boolean): Promise<void>;
123
+ /** Defers the initial interaction response. @param options `true` or `{ ephemeral: true }` makes the eventual response private. @returns Promise fulfilled after acknowledgement. @throws {Error} When already acknowledged or REST fails. */ deferReply(options?: boolean | {
124
+ ephemeral?: boolean;
125
+ }): Promise<void>;
84
126
  /** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */ editReply(options: InteractionReplyOptions): Promise<unknown>;
85
127
  /** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */ deleteReply(): Promise<void>;
86
128
  /** Sends a follow-up message using the interaction webhook. @param options Follow-up message options. @returns Discord response. @throws {Error} When REST fails. */ followUp(options: InteractionReplyOptions | string): Promise<unknown>;
87
129
  /** Updates the message for a component interaction. */ update(options: InteractionReplyOptions | string): Promise<unknown>;
88
130
  /** Opens a modal dialog in the user's client. @param modal Modal builder output or raw modal callback data. @returns Discord response. @throws {Error} When already acknowledged or REST fails. */
89
131
  showModal(modal: {
132
+ toJSON(): {
133
+ custom_id: string;
134
+ title: string;
135
+ components: unknown[];
136
+ };
137
+ } | {
90
138
  custom_id: string;
91
139
  title: string;
92
140
  components: unknown[];
@@ -104,6 +152,8 @@ export declare class CommandInteraction extends Interaction {
104
152
  export declare class ComponentInteraction extends Interaction {
105
153
  /** Gets component custom ID. */
106
154
  get customId(): string;
155
+ /** ID of the message the component is on. */
156
+ get messageId(): string | undefined;
107
157
  /** Gets component type. */
108
158
  get componentType(): number;
109
159
  /** Gets selected values for select menu component interactions. */
@@ -47,6 +47,8 @@ export declare class CommandOptions {
47
47
  /** Gets the raw resolved user or role data for a mentionable option. @param name Option name. @param required If true, throws when missing. */
48
48
  getMentionable(name: string, required?: false): Record<string, unknown> | null;
49
49
  getMentionable(name: string, required: true): Record<string, unknown>;
50
+ /** Whether a mentionable option picked a user or a role; null when the option is missing. @param name Option name. */
51
+ getMentionableType(name: string): "user" | "role" | null;
50
52
  /** Gets the raw resolved attachment data for an attachment option. @param name Option name. @param required If true, throws when missing. */
51
53
  getAttachment(name: string, required?: false): Record<string, unknown> | null;
52
54
  getAttachment(name: string, required: true): Record<string, unknown>;
@@ -1,15 +1,15 @@
1
1
  import { BaseStructure, Channel, User } from "./base.js";
2
2
  import { PermissionsBitField } from "@lunibee/core";
3
- import type { ImageURLOptions } from "./base.js";
3
+ import type { ImageURLOptions, ResourceContext } from "./base.js";
4
4
  /** A Discord guild member. */
5
5
  export declare class GuildMember {
6
+ #private;
6
7
  /** User represented by the member. */ readonly user: User;
7
8
  /** Guild containing the member. */ readonly guildId: string;
8
9
  /** Nickname, if configured. */ nickname: string | null;
9
10
  /** Role IDs assigned to the member. */ readonly roleIds: string[];
10
11
  /** Whether the member is pending membership screening. */ pending: boolean;
11
12
  /** Member join timestamp. */ joinedAt?: Date;
12
- /** Raw effective permission bitfield supplied by Discord. */ readonly permissions: PermissionsBitField;
13
13
  /** Member-specific avatar hash, if set. */ avatarHash: string | null;
14
14
  /** When the member started boosting the guild. */ premiumSince: Date | null;
15
15
  /** When the member's timeout expires (null if not timed out). */ timedOutUntil: Date | null;
@@ -36,7 +36,33 @@ export declare class GuildMember {
36
36
  premium_since?: string | null;
37
37
  communication_disabled_until?: string | null;
38
38
  flags?: number;
39
- });
39
+ }, context?: ResourceContext);
40
+ /**
41
+ * The member's permissions. Discord sends them with interactions (already
42
+ * resolved for the channel); anywhere else they are computed at guild
43
+ * level from the cached roles each time they are read, so they follow role
44
+ * changes. Empty when the guild's roles are not cached.
45
+ */
46
+ get permissions(): PermissionsBitField;
47
+ /** The member's permissions in a channel, with its overwrites. Null when the channel or guild is not cached. @param channelId Channel ID. */
48
+ permissionsIn(channelId: string): PermissionsBitField | null;
49
+ /** Kicks this member. @param reason Audit-log reason. */
50
+ kick(reason?: string): Promise<void>;
51
+ /** Bans this member. @param options Audit-log reason and seconds of messages to delete. */
52
+ ban(options?: {
53
+ reason?: string;
54
+ deleteMessageSeconds?: number;
55
+ }): Promise<void>;
56
+ /** Edits this member (nickname, roles, voice state, timeout). @param options Discord member fields. @param reason Audit-log reason. */
57
+ edit(options: Record<string, unknown>, reason?: string): Promise<GuildMember>;
58
+ /** Times this member out, or clears the timeout with null. @param milliseconds Timeout length (Discord allows up to 28 days). @param reason Audit-log reason. */
59
+ timeout(milliseconds: number | null, reason?: string): Promise<GuildMember>;
60
+ /** Sets or clears (null) this member's nickname. @param nickname New nickname. @param reason Audit-log reason. */
61
+ setNickname(nickname: string | null, reason?: string): Promise<GuildMember>;
62
+ /** Gives this member a role. @param roleId Role ID. @param reason Audit-log reason. */
63
+ addRole(roleId: string, reason?: string): Promise<void>;
64
+ /** Takes a role from this member. @param roleId Role ID. @param reason Audit-log reason. */
65
+ removeRole(roleId: string, reason?: string): Promise<void>;
40
66
  /** Effective member display name β€” nickname, falling back to user display name. */
41
67
  get displayName(): string;
42
68
  /** Whether this member is currently timed out. */
@@ -160,6 +160,22 @@ export interface ClientOptions {
160
160
  intents: GatewayIntentResolvable;
161
161
  gateway?: GatewayOptions;
162
162
  rest?: RESTOptions;
163
+ /** Opt-in bounded per-channel message cache. Messages are not cached by default. */
164
+ messageCache?: {
165
+ maxSize?: number;
166
+ ttl?: number;
167
+ };
168
+ /**
169
+ * Which resources the client keeps from Gateway events. Everything is
170
+ * cached by default; large bots can turn off what they do not read.
171
+ * Events are still emitted either way.
172
+ */
173
+ cache?: {
174
+ users?: boolean;
175
+ members?: boolean;
176
+ roles?: boolean;
177
+ emojis?: boolean;
178
+ };
163
179
  }
164
180
  /** Gateway connection configuration. */
165
181
  export interface GatewayOptions {
@@ -40,6 +40,8 @@ export declare const MessageFlags: {
40
40
  readonly Loading: 128;
41
41
  readonly IsComponentsV2: 32768;
42
42
  };
43
+ /** One {@link MessageFlags} value, usable as a type. */
44
+ export type MessageFlags = (typeof MessageFlags)[keyof typeof MessageFlags];
43
45
  /** Discord channel types. */
44
46
  export declare const ChannelType: {
45
47
  readonly GuildText: 0;
@@ -75,6 +77,8 @@ export declare const ComponentType: {
75
77
  readonly ContentInventoryEntry: 16;
76
78
  readonly Container: 17;
77
79
  };
80
+ /** One {@link ComponentType} value, usable as a type. */
81
+ export type ComponentType = (typeof ComponentType)[keyof typeof ComponentType];
78
82
  /** Discord button style types. */
79
83
  export declare const ButtonStyle: {
80
84
  readonly Primary: 1;
@@ -84,11 +88,15 @@ export declare const ButtonStyle: {
84
88
  readonly Link: 5;
85
89
  readonly Premium: 6;
86
90
  };
91
+ /** One {@link ButtonStyle} value, usable as a type: `style: ButtonStyle`. */
92
+ export type ButtonStyle = (typeof ButtonStyle)[keyof typeof ButtonStyle];
87
93
  /** Discord text input style types. */
88
94
  export declare const TextInputStyle: {
89
95
  readonly Short: 1;
90
96
  readonly Paragraph: 2;
91
97
  };
98
+ /** One {@link TextInputStyle} value, usable as a type. */
99
+ export type TextInputStyle = (typeof TextInputStyle)[keyof typeof TextInputStyle];
92
100
  /** Discord interaction response types. */
93
101
  export declare const InteractionResponseType: {
94
102
  readonly Pong: 1;
@@ -323,6 +331,10 @@ export interface APIMessage {
323
331
  purchase_notification?: Record<string, unknown>;
324
332
  poll?: Record<string, unknown>;
325
333
  guild_id?: Snowflake;
334
+ /** The author's guild member, on guild messages from the Gateway (without `user`; the author is the user). */
335
+ member?: Omit<APIGuildMember, "user"> & {
336
+ user?: UserData;
337
+ };
326
338
  }
327
339
  /** Raw Discord channel object. */
328
340
  export interface APIChannel {
@@ -330,7 +342,7 @@ export interface APIChannel {
330
342
  type: number;
331
343
  guild_id?: Snowflake;
332
344
  position?: number;
333
- permission_overwrites?: Array<Record<string, unknown>>;
345
+ permission_overwrites?: APIOverwrite[];
334
346
  name?: string | null;
335
347
  topic?: string | null;
336
348
  nsfw?: boolean;
@@ -793,3 +805,57 @@ export interface ApplicationCommandData {
793
805
  dm_permission?: boolean;
794
806
  nsfw?: boolean;
795
807
  }
808
+ /** A channel permission overwrite for a role (type 0) or member (type 1). */
809
+ export interface APIOverwrite {
810
+ id: Snowflake;
811
+ type: 0 | 1;
812
+ /** Allowed permission bits as a decimal string. */
813
+ allow: string;
814
+ /** Denied permission bits as a decimal string. */
815
+ deny: string;
816
+ }
817
+ /** Raw Discord soundboard sound. */
818
+ export interface APISoundboardSound {
819
+ sound_id: string;
820
+ name: string;
821
+ volume: number;
822
+ emoji_id: string | null;
823
+ emoji_name: string | null;
824
+ guild_id?: string;
825
+ available: boolean;
826
+ user?: UserData;
827
+ }
828
+ /** Raw Discord SKU. */
829
+ export interface APISKU {
830
+ id: string;
831
+ type: number;
832
+ application_id: string;
833
+ name: string;
834
+ slug: string;
835
+ flags: number;
836
+ }
837
+ /** Raw Discord entitlement. */
838
+ export interface APIEntitlement {
839
+ id: string;
840
+ sku_id: string;
841
+ application_id: string;
842
+ user_id?: string;
843
+ guild_id?: string;
844
+ type: number;
845
+ deleted: boolean;
846
+ starts_at?: string | null;
847
+ ends_at?: string | null;
848
+ consumed?: boolean;
849
+ }
850
+ /** Raw Discord subscription. */
851
+ export interface APISubscription {
852
+ id: string;
853
+ user_id: string;
854
+ sku_ids: string[];
855
+ entitlement_ids: string[];
856
+ current_period_start: string;
857
+ current_period_end: string;
858
+ status: number;
859
+ canceled_at: string | null;
860
+ country?: string;
861
+ }
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
3
  "sources": ["../../packages/types/src/gateway.ts", "../../packages/types/src/index.ts"],
4
4
  "sourcesContent": [
5
- "// ─── Gateway Intents ─────────────────────────────────────────────────────────\n\n/** Gateway intent bit flags supported by Discord (PascalCase). */\nexport const GatewayIntentBits = {\n Guilds: 1 << 0,\n GuildMembers: 1 << 1,\n GuildModeration: 1 << 2,\n GuildExpressions: 1 << 3,\n GuildIntegrations: 1 << 4,\n GuildWebhooks: 1 << 5,\n GuildInvites: 1 << 6,\n GuildVoiceStates: 1 << 7,\n GuildPresences: 1 << 8,\n GuildMessages: 1 << 9,\n GuildMessageReactions: 1 << 10,\n GuildMessageTyping: 1 << 11,\n DirectMessages: 1 << 12,\n DirectMessageReactions: 1 << 13,\n DirectMessageTyping: 1 << 14,\n MessageContent: 1 << 15,\n GuildScheduledEvents: 1 << 16,\n AutoModerationConfiguration: 1 << 20,\n AutoModerationExecution: 1 << 21,\n GuildMessagePolls: 1 << 24,\n DirectMessagePolls: 1 << 25,\n} as const;\n\n/** Idiomatic camelCase Gateway intent bit flags supported by Discord. */\nexport const IntentBits = {\n guild: 1 << 0,\n guilds: 1 << 0,\n guildMembers: 1 << 1,\n guildModeration: 1 << 2,\n guildBans: 1 << 2,\n guildExpressions: 1 << 3,\n guildEmojis: 1 << 3,\n guildEmojisAndStickers: 1 << 3,\n guildIntegrations: 1 << 4,\n guildWebhooks: 1 << 5,\n guildInvites: 1 << 6,\n guildVoiceStates: 1 << 7,\n guildPresences: 1 << 8,\n guildMessages: 1 << 9,\n guildMessage: 1 << 9,\n guildMessageReactions: 1 << 10,\n guildMessageTyping: 1 << 11,\n directMessages: 1 << 12,\n directMessageReactions: 1 << 13,\n directMessageTyping: 1 << 14,\n messageContent: 1 << 15,\n guildScheduledEvents: 1 << 16,\n autoModerationConfiguration: 1 << 20,\n autoModerationExecution: 1 << 21,\n guildMessagePolls: 1 << 24,\n directMessagePolls: 1 << 25,\n} as const;\n\n/** Alias for IntentBits. */\nexport const Intents = IntentBits;\n\n/** Gateway intent resolvable value (single bitfield, enum key, or array of bitfields/strings). */\nexport type GatewayIntentResolvable =\n | number\n | keyof typeof GatewayIntentBits\n | keyof typeof IntentBits\n | (\n | number\n | keyof typeof GatewayIntentBits\n | keyof typeof IntentBits\n | string\n )[]\n | { readonly bitfield: number };\n\n/** Resolves any GatewayIntentResolvable into a raw bitfield integer. */\nexport function resolveGatewayIntents(\n intents: GatewayIntentResolvable,\n): number {\n if (typeof intents === \"number\") return intents;\n if (intents && typeof intents === \"object\" && !Array.isArray(intents))\n return intents.bitfield;\n if (Array.isArray(intents)) {\n return intents.reduce<number>((acc, intent) => {\n return acc | resolveGatewayIntents(intent as any);\n }, 0);\n }\n if (typeof intents === \"string\") {\n if (intents in GatewayIntentBits)\n return (GatewayIntentBits as Record<string, number>)[intents]!;\n if (intents in IntentBits)\n return (IntentBits as Record<string, number>)[intents]!;\n const lower = intents.charAt(0).toLowerCase() + intents.slice(1);\n if (lower in IntentBits)\n return (IntentBits as Record<string, number>)[lower]!;\n const num = Number(intents);\n if (!Number.isNaN(num)) return num;\n }\n return 0;\n}\n\n/**\n * Discord.js-familiar intent bitfield.\n * @example new IntentsBitField([IntentsBitField.Flags.Guilds, \"GuildMessages\"])\n */\nexport class IntentsBitField {\n /** Intent flag values by name. */\n public static readonly Flags = GatewayIntentBits;\n /** Raw intent bitfield. */\n public bitfield: number;\n\n public constructor(bits: GatewayIntentResolvable = 0) {\n this.bitfield = resolveGatewayIntents(bits);\n }\n\n /** Whether every given intent is set. */\n public has(bits: GatewayIntentResolvable): boolean {\n const resolved = resolveGatewayIntents(bits);\n return (this.bitfield & resolved) === resolved;\n }\n\n /** Whether any given intent is set. */\n public any(bits: GatewayIntentResolvable): boolean {\n return (this.bitfield & resolveGatewayIntents(bits)) !== 0;\n }\n\n /** Adds intents in place. @returns This bitfield. */\n public add(...bits: GatewayIntentResolvable[]): this {\n for (const bit of bits) this.bitfield |= resolveGatewayIntents(bit);\n return this;\n }\n\n /** Removes intents in place. @returns This bitfield. */\n public remove(...bits: GatewayIntentResolvable[]): this {\n for (const bit of bits) this.bitfield &= ~resolveGatewayIntents(bit);\n return this;\n }\n\n /** Names of the set intents. */\n public toArray(): (keyof typeof GatewayIntentBits)[] {\n return (\n Object.keys(GatewayIntentBits) as (keyof typeof GatewayIntentBits)[]\n ).filter((name) => this.has(GatewayIntentBits[name]));\n }\n\n /** Whether this equals another bitfield. */\n public equals(bits: GatewayIntentResolvable): boolean {\n return this.bitfield === resolveGatewayIntents(bits);\n }\n\n public valueOf(): number {\n return this.bitfield;\n }\n\n public toJSON(): number {\n return this.bitfield;\n }\n}\n\n// ─── Gateway Config ───────────────────────────────────────────────────────────\n\n/** Gateway connection properties (OS, browser, device). */\nexport interface GatewayProperties {\n os?: string;\n browser?: string;\n device?: string;\n [key: string]: unknown;\n}\n/** Gateway presence activity. */\nexport interface GatewayPresenceActivity {\n name: string;\n type?: number;\n url?: string;\n state?: string;\n}\n/** Gateway presence data. */\nexport interface GatewayPresence {\n status?: \"online\" | \"dnd\" | \"idle\" | \"invisible\" | \"offline\";\n activities?: GatewayPresenceActivity[];\n afk?: boolean;\n since?: number | null;\n}\n/** Client configuration. */\nexport interface ClientOptions {\n token: string;\n intents: GatewayIntentResolvable;\n gateway?: GatewayOptions;\n rest?: RESTOptions;\n}\n/** Gateway connection configuration. */\nexport interface GatewayOptions {\n intents?: GatewayIntentResolvable;\n reconnect?: boolean;\n maxReconnectAttempts?: number;\n reconnectBaseDelay?: number;\n reconnectMaxDelay?: number;\n shardId?: number;\n shardCount?: number;\n properties?: GatewayProperties;\n presence?: GatewayPresence;\n}\n\n/** REST request configuration. */\nexport interface RESTOptions {\n timeout?: number;\n retries?: number;\n baseURL?: string;\n}\n",
6
- "/** Discord API snowflake identifier. */\nexport type Snowflake = string;\n\nexport * from \"./gateway.js\";\nexport * from \"./gateway-events.js\";\n\n// ─── Core Discord Objects ─────────────────────────────────────────────────────\n\n/** Discord user object. */\nexport interface UserData {\n id: Snowflake;\n username: string;\n discriminator?: string;\n global_name?: string | null;\n avatar?: string | null;\n bot?: boolean;\n system?: boolean;\n public_flags?: number;\n}\n/** Current authenticated bot user. */\nexport type ClientUser = UserData;\n/** Discord Gateway payload envelope. */\nexport interface GatewayPayload<T = unknown> {\n op: number;\n d: T | null;\n s: number | null;\n t: string | null;\n}\n/** Generic Discord API error payload. */\nexport interface APIError {\n code?: number;\n message?: string;\n errors?: Record<string, unknown>;\n}\n\n// ─── Discord Flags & Enums ────────────────────────────────────────────────────\n\n/** Discord message flags. */\nexport const MessageFlags = {\n Crossposted: 1,\n IsCrosspost: 2,\n SuppressEmbeds: 4,\n SourceMessageDeleted: 8,\n Urgent: 16,\n HasThread: 32,\n Ephemeral: 64,\n Loading: 128,\n IsComponentsV2: 32768,\n} as const;\n\n/** Discord channel types. */\nexport const ChannelType = {\n GuildText: 0,\n DM: 1,\n GuildVoice: 2,\n GroupDM: 3,\n GuildCategory: 4,\n GuildAnnouncement: 5,\n AnnouncementThread: 10,\n PublicThread: 11,\n PrivateThread: 12,\n GuildStageVoice: 13,\n GuildDirectory: 14,\n GuildForum: 15,\n GuildMedia: 16,\n} as const;\n\n/** Discord component types. */\nexport const ComponentType = {\n ActionRow: 1,\n Button: 2,\n StringSelect: 3,\n TextInput: 4,\n UserSelect: 5,\n RoleSelect: 6,\n MentionableSelect: 7,\n ChannelSelect: 8,\n Section: 9,\n TextDisplay: 10,\n Thumbnail: 11,\n MediaGallery: 12,\n File: 13,\n Separator: 14,\n ContentInventoryEntry: 16,\n Container: 17,\n} as const;\n\n/** Discord button style types. */\nexport const ButtonStyle = {\n Primary: 1,\n Secondary: 2,\n Success: 3,\n Danger: 4,\n Link: 5,\n Premium: 6,\n} as const;\n\n/** Discord text input style types. */\nexport const TextInputStyle = {\n Short: 1,\n Paragraph: 2,\n} as const;\n\n/** Discord interaction response types. */\nexport const InteractionResponseType = {\n Pong: 1,\n ChannelMessage: 4,\n DeferredChannelMessage: 5,\n DeferredMessageUpdate: 6,\n MessageUpdate: 7,\n Autocomplete: 8,\n Modal: 9,\n} as const;\n\n/** Discord sticker format types. */\nexport const StickerFormatType = {\n PNG: 1,\n APNG: 2,\n Lottie: 3,\n GIF: 4,\n} as const;\n\n/** Discord sticker types. */\nexport const StickerType = {\n Standard: 1,\n Guild: 2,\n} as const;\n\n/** Discord verification levels. */\nexport const VerificationLevel = {\n None: 0,\n Low: 1,\n Medium: 2,\n High: 3,\n VeryHigh: 4,\n} as const;\n\n/** Discord premium tiers. */\nexport const PremiumTier = {\n None: 0,\n Tier1: 1,\n Tier2: 2,\n Tier3: 3,\n} as const;\n\n// ─── Embeds ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord embed footer object. */\nexport interface APIEmbedFooter {\n text: string;\n icon_url?: string;\n proxy_icon_url?: string;\n}\n/** Raw Discord embed image/thumbnail/video object. */\nexport interface APIEmbedMedia {\n url: string;\n proxy_url?: string;\n height?: number;\n width?: number;\n}\n/** Raw Discord embed provider object. */\nexport interface APIEmbedProvider {\n name?: string;\n url?: string;\n}\n/** Raw Discord embed author object. */\nexport interface APIEmbedAuthor {\n name: string;\n url?: string;\n icon_url?: string;\n proxy_icon_url?: string;\n}\n/** Raw Discord embed field object. */\nexport interface APIEmbedField {\n name: string;\n value: string;\n inline?: boolean;\n}\n/** Raw Discord embed object. */\nexport interface APIEmbed {\n title?: string;\n type?: string;\n description?: string;\n url?: string;\n timestamp?: string;\n color?: number;\n footer?: APIEmbedFooter;\n image?: APIEmbedMedia;\n thumbnail?: APIEmbedMedia;\n video?: APIEmbedMedia;\n provider?: APIEmbedProvider;\n author?: APIEmbedAuthor;\n fields?: APIEmbedField[];\n}\n\n// ─── Message Components ───────────────────────────────────────────────────────\n\n/** Raw Discord select menu option. */\nexport interface APISelectMenuOption {\n label: string;\n value: string;\n description?: string;\n emoji?: APIPartialEmoji;\n default?: boolean;\n}\n/** Raw Discord emoji (partial, as used in components). */\nexport interface APIPartialEmoji {\n id?: Snowflake | null;\n name?: string | null;\n animated?: boolean;\n}\n/** Raw Discord button component. */\nexport interface APIButtonComponent {\n type: 2;\n style: number;\n label?: string;\n emoji?: APIPartialEmoji;\n custom_id?: string;\n url?: string;\n sku_id?: string;\n disabled?: boolean;\n}\n/** Raw Discord select menu component. */\nexport interface APISelectMenuComponent {\n type: 3 | 5 | 6 | 7 | 8;\n custom_id: string;\n options?: APISelectMenuOption[];\n channel_types?: number[];\n placeholder?: string;\n min_values?: number;\n max_values?: number;\n disabled?: boolean;\n}\n/** Raw Discord text input component. */\nexport interface APITextInputComponent {\n type: 4;\n custom_id: string;\n style: number;\n label: string;\n min_length?: number;\n max_length?: number;\n required?: boolean;\n value?: string;\n placeholder?: string;\n}\n/** Union of all raw message component types. */\nexport type APIMessageActionRowComponent =\n APIButtonComponent | APISelectMenuComponent | APITextInputComponent;\n/** Raw Discord action row component. */\nexport interface APIActionRowComponent {\n type: 1;\n id?: number;\n components: APIMessageActionRowComponent[];\n}\n/** Union including action rows and V2 components. */\nexport type APIMessageComponent =\n APIActionRowComponent | { type: Exclude<number, 1>; [key: string]: any };\n\n// ─── Attachments ─────────────────────────────────────────────────────────────\n\n/** Raw Discord attachment object. */\nexport interface APIAttachment {\n id: Snowflake;\n filename: string;\n description?: string | null;\n content_type?: string;\n size: number;\n url: string;\n proxy_url: string;\n height?: number | null;\n width?: number | null;\n ephemeral?: boolean;\n duration_secs?: number;\n waveform?: string;\n flags?: number;\n}\n\n// ─── Stickers ────────────────────────────────────────────────────────────────\n\n/** Compact sticker item as included in messages. */\nexport interface APIStickerItem {\n id: Snowflake;\n name: string;\n format_type: number;\n}\n/** Full Discord sticker object. */\nexport interface APISticker {\n id: Snowflake;\n pack_id?: Snowflake;\n name: string;\n description?: string | null;\n tags?: string;\n type: number;\n format_type: number;\n available?: boolean;\n guild_id?: Snowflake;\n user?: UserData;\n sort_value?: number;\n}\n\n// ─── Messages ────────────────────────────────────────────────────────────────\n\n/** Raw Discord message reference. */\nexport interface APIMessageReference {\n type?: number;\n message_id?: Snowflake;\n channel_id?: Snowflake;\n guild_id?: Snowflake;\n fail_if_not_exists?: boolean;\n}\n/** Raw Discord message reaction. */\nexport interface APIMessageReaction {\n count: number;\n count_details?: Record<string, number>;\n me?: boolean;\n me_burst?: boolean;\n emoji: APIPartialEmoji;\n burst_colors?: string[];\n}\n/** Raw Discord message object. */\nexport interface APIMessage {\n id: Snowflake;\n channel_id: Snowflake;\n author: UserData;\n content: string;\n timestamp?: string;\n edited_timestamp?: string | null;\n tts?: boolean;\n mention_everyone?: boolean;\n mentions?: UserData[];\n mention_roles?: Snowflake[];\n mention_channels?: Array<Record<string, unknown>>;\n attachments?: APIAttachment[];\n embeds?: APIEmbed[];\n reactions?: APIMessageReaction[];\n nonce?: string | number | null;\n pinned?: boolean;\n webhook_id?: Snowflake;\n type?: number;\n activity?: Record<string, unknown>;\n application?: Record<string, unknown>;\n application_id?: Snowflake;\n message_reference?: APIMessageReference;\n flags?: number;\n referenced_message?: APIMessage | null;\n interaction_metadata?: Record<string, unknown>;\n thread?: Record<string, unknown>;\n components?: APIMessageComponent[];\n sticker_items?: APIStickerItem[];\n stickers?: APISticker[];\n position?: number;\n role_subscription_data?: Record<string, unknown>;\n purchase_notification?: Record<string, unknown>;\n poll?: Record<string, unknown>;\n guild_id?: Snowflake;\n}\n\n// ─── Channels ────────────────────────────────────────────────────────────────\n\n/** Raw Discord channel object. */\nexport interface APIChannel {\n id: Snowflake;\n type: number;\n guild_id?: Snowflake;\n position?: number;\n permission_overwrites?: Array<Record<string, unknown>>;\n name?: string | null;\n topic?: string | null;\n nsfw?: boolean;\n last_message_id?: Snowflake | null;\n bitrate?: number;\n user_limit?: number;\n rate_limit_per_user?: number;\n recipients?: UserData[];\n icon?: string | null;\n owner_id?: Snowflake;\n application_id?: Snowflake;\n parent_id?: Snowflake | null;\n last_pin_timestamp?: string | null;\n rtc_region?: string | null;\n video_quality_mode?: number;\n message_count?: number;\n member_count?: number;\n thread_metadata?: APIThreadMetadata;\n default_auto_archive_duration?: number;\n flags?: number;\n total_message_sent?: number;\n available_tags?: APIForumTag[];\n default_reaction_emoji?: APIPartialEmoji | null;\n default_thread_rate_limit_per_user?: number;\n default_sort_order?: number | null;\n default_forum_layout?: number;\n}\n\n/** Raw Discord thread metadata. */\nexport interface APIThreadMetadata {\n archived: boolean;\n auto_archive_duration: number;\n archive_timestamp: string;\n locked: boolean;\n invitable?: boolean;\n create_timestamp?: string | null;\n}\n\n/** Raw Discord forum tag. */\nexport interface APIForumTag {\n id: Snowflake;\n name: string;\n moderated: boolean;\n emoji_id?: Snowflake | null;\n emoji_name?: string | null;\n}\n\n/** Raw Discord thread member. */\nexport interface APIThreadMember {\n id?: Snowflake;\n user_id?: Snowflake;\n join_timestamp: string;\n flags: number;\n member?: APIGuildMember;\n}\n\n// ─── Roles ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord role object. */\nexport interface APIRole {\n id: Snowflake;\n name: string;\n color: number;\n hoist: boolean;\n icon?: string | null;\n unicode_emoji?: string | null;\n position: number;\n permissions: string;\n managed: boolean;\n mentionable: boolean;\n tags?: Record<string, unknown>;\n flags?: number;\n}\n\n// ─── Emoji ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord emoji object. */\nexport interface APIEmoji {\n id: Snowflake | null;\n name: string | null;\n roles?: Snowflake[];\n user?: UserData;\n require_colons?: boolean;\n managed?: boolean;\n animated?: boolean;\n available?: boolean;\n}\n\n// ─── Guilds ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord guild object. */\nexport interface APIGuild {\n id: Snowflake;\n name: string;\n icon?: string | null;\n icon_hash?: string | null;\n splash?: string | null;\n discovery_splash?: string | null;\n owner?: boolean;\n owner_id?: Snowflake;\n permissions?: string;\n afk_channel_id?: Snowflake | null;\n afk_timeout?: number;\n widget_enabled?: boolean;\n widget_channel_id?: Snowflake | null;\n verification_level?: number;\n default_message_notifications?: number;\n explicit_content_filter?: number;\n roles?: APIRole[];\n emojis?: APIEmoji[];\n stickers?: APISticker[];\n features?: string[];\n mfa_level?: number;\n application_id?: Snowflake | null;\n system_channel_id?: Snowflake | null;\n system_channel_flags?: number;\n rules_channel_id?: Snowflake | null;\n max_presences?: number | null;\n max_members?: number;\n vanity_url_code?: string | null;\n description?: string | null;\n banner?: string | null;\n premium_tier?: number;\n premium_subscription_count?: number;\n preferred_locale?: string;\n public_updates_channel_id?: Snowflake | null;\n max_video_channel_users?: number;\n approximate_member_count?: number;\n approximate_presence_count?: number;\n nsfw_level?: number;\n safety_alerts_channel_id?: Snowflake | null;\n member_count?: number;\n}\n\n// ─── Welcome Screen ───────────────────────────────────────────────────────────\n\nexport interface APIWelcomeScreenChannel {\n channel_id: Snowflake;\n description: string;\n emoji_id: Snowflake | null;\n emoji_name: string | null;\n}\n\nexport interface APIGuildWelcomeScreen {\n description: string | null;\n welcome_channels: APIWelcomeScreenChannel[];\n}\n\n// ─── Guild Onboarding ─────────────────────────────────────────────────────────\n\nexport interface APIOnboardingPromptOption {\n id: Snowflake;\n channel_ids: Snowflake[];\n role_ids: Snowflake[];\n emoji?: APIPartialEmoji;\n title: string;\n description: string | null;\n}\n\nexport interface APIOnboardingPrompt {\n id: Snowflake;\n type: number;\n options: APIOnboardingPromptOption[];\n title: string;\n single_select: boolean;\n required: boolean;\n in_onboarding: boolean;\n}\n\nexport interface APIGuildOnboarding {\n guild_id: Snowflake;\n prompts: APIOnboardingPrompt[];\n default_channel_ids: Snowflake[];\n enabled: boolean;\n mode: number;\n}\n\n/** Raw Discord guild member object. */\nexport interface APIGuildMember {\n user: UserData;\n nick?: string | null;\n avatar?: string | null;\n roles: Snowflake[];\n joined_at: string;\n premium_since?: string | null;\n deaf?: boolean;\n mute?: boolean;\n flags?: number;\n pending?: boolean;\n permissions?: string;\n communication_disabled_until?: string | null;\n guild_id?: Snowflake;\n}\n\n// ─── Voice ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord voice state object. */\nexport interface APIVoiceState {\n guild_id?: Snowflake;\n channel_id?: Snowflake | null;\n user_id: Snowflake;\n member?: APIGuildMember;\n session_id: string;\n deaf: boolean;\n mute: boolean;\n self_deaf: boolean;\n self_mute: boolean;\n self_stream?: boolean;\n self_video: boolean;\n suppress: boolean;\n request_to_speak_timestamp?: string | null;\n}\n\n/** Raw Discord voice server update event. */\nexport interface APIVoiceServerUpdate {\n token: string;\n guild_id: Snowflake;\n endpoint?: string | null;\n}\n\n// ─── Presence ────────────────────────────────────────────────────────────────\n\n/** Raw Discord activity object. */\nexport interface APIActivity {\n name: string;\n type: number;\n url?: string | null;\n created_at: number;\n state?: string | null;\n details?: string | null;\n emoji?: APIPartialEmoji | null;\n}\n\n/** Raw Discord presence update event. */\nexport interface APIPresenceUpdate {\n user: { id: Snowflake } & Partial<UserData>;\n guild_id: Snowflake;\n status: string;\n activities: APIActivity[];\n client_status: { desktop?: string; mobile?: string; web?: string };\n}\n\n// ─── Typing ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord typing start event. */\nexport interface APITypingStart {\n channel_id: Snowflake;\n guild_id?: Snowflake;\n user_id: Snowflake;\n timestamp: number;\n member?: APIGuildMember;\n}\n\n// ─── Guilds ──────────────────────────────────────────────────────────────────\n\n/** Raw Discord guild preview. */\nexport interface APIGuildPreview {\n id: Snowflake;\n name: string;\n icon: string | null;\n splash: string | null;\n discovery_splash: string | null;\n emojis: unknown[];\n features: string[];\n approximate_member_count: number;\n approximate_presence_count: number;\n description: string | null;\n stickers: unknown[];\n}\n\n// ─── Invites ─────────────────────────────────────────────────────────────────\n\n/** Raw Discord invite. */\nexport interface APIInvite {\n code: string;\n guild?: Partial<APIGuild>;\n channel: Partial<APIChannel>;\n inviter?: UserData;\n target_type?: number;\n target_user?: UserData;\n approximate_presence_count?: number;\n approximate_member_count?: number;\n}\n\n/** Raw Discord invite create event. */\nexport interface APIInviteCreate {\n channel_id: Snowflake;\n code: string;\n created_at: string;\n guild_id?: Snowflake;\n inviter?: UserData;\n max_age: number;\n max_uses: number;\n target_type?: number;\n target_user?: UserData;\n temporary: boolean;\n uses: number;\n}\n\n/** Raw Discord invite delete event. */\nexport interface APIInviteDelete {\n channel_id: Snowflake;\n guild_id?: Snowflake;\n code: string;\n}\n\n// ─── Webhooks ────────────────────────────────────────────────────────────────\n\n/** Raw Discord webhooks update event. */\nexport interface APIWebhooksUpdate {\n guild_id: Snowflake;\n channel_id: Snowflake;\n}\n\n/** Raw Discord webhook object. */\nexport interface APIWebhook {\n id: Snowflake;\n type: number;\n guild_id?: Snowflake | null;\n channel_id?: Snowflake | null;\n user?: UserData;\n name?: string | null;\n avatar?: string | null;\n token?: string;\n application_id?: Snowflake | null;\n url?: string;\n}\n\n// ─── AutoMod ─────────────────────────────────────────────────────────────────\n\n/** Raw Discord AutoMod action. */\nexport interface APIAutoModerationAction {\n type: number;\n metadata?: {\n channel_id?: Snowflake;\n duration_seconds?: number;\n custom_message?: string;\n };\n}\n\n// ─── Audit Logs ──────────────────────────────────────────────────────────────\n\n/** Raw Discord audit log change object. */\nexport interface APIAuditLogChange {\n new_value?: unknown;\n old_value?: unknown;\n key: string;\n}\n\n/** Raw Discord audit log entry options object. */\nexport interface APIAuditLogOptions {\n app_id?: Snowflake;\n auto_moderation_rule_name?: string;\n auto_moderation_rule_trigger_type?: string;\n channel_id?: Snowflake;\n count?: string;\n delete_member_days?: string;\n id?: Snowflake;\n members_removed?: string;\n message_id?: Snowflake;\n role_name?: string;\n type?: string;\n integration_type?: string;\n}\n\n/** Raw Discord audit log entry object. */\nexport interface APIAuditLogEntry {\n target_id: string | null;\n changes?: APIAuditLogChange[];\n user_id: Snowflake | null;\n id: Snowflake;\n action_type: number;\n options?: APIAuditLogOptions;\n reason?: string;\n}\n\n/** Raw Discord audit log object. */\nexport interface APIAuditLog {\n audit_log_entries: APIAuditLogEntry[];\n guild_scheduled_events: APIGuildScheduledEvent[];\n integrations: Array<Record<string, unknown>>;\n threads: APIChannel[];\n users: UserData[];\n webhooks: APIWebhook[];\n application_commands: APIApplicationCommand[];\n auto_moderation_rules: APIAutoModerationRule[];\n}\n\n/** Raw Discord AutoMod rule object. */\nexport interface APIAutoModerationRule {\n id: Snowflake;\n guild_id: Snowflake;\n name: string;\n creator_id: Snowflake;\n event_type: number;\n trigger_type: number;\n trigger_metadata: Record<string, unknown>;\n actions: APIAutoModerationAction[];\n enabled: boolean;\n exempt_roles: Snowflake[];\n exempt_channels: Snowflake[];\n}\n\n/** Raw Discord AutoMod action execution event. */\nexport interface APIAutoModerationActionExecution {\n guild_id: Snowflake;\n action: APIAutoModerationAction;\n rule_id: Snowflake;\n rule_trigger_type: number;\n user_id: Snowflake;\n channel_id?: Snowflake;\n message_id?: Snowflake;\n alert_system_message_id?: Snowflake;\n content: string;\n matched_keyword?: string | null;\n matched_content?: string | null;\n}\n\n// ─── Scheduled Events ─────────────────────────────────────────────────────────\n\n/** Raw Discord guild scheduled event entity metadata. */\nexport interface APIGuildScheduledEventEntityMetadata {\n location?: string;\n}\n\n/** Raw Discord guild scheduled event object. */\nexport interface APIGuildScheduledEvent {\n id: Snowflake;\n guild_id: Snowflake;\n channel_id?: Snowflake | null;\n creator_id?: Snowflake | null;\n name: string;\n description?: string | null;\n scheduled_start_time: string;\n scheduled_end_time?: string | null;\n privacy_level: number;\n status: number;\n entity_type: number;\n entity_id?: Snowflake | null;\n entity_metadata?: APIGuildScheduledEventEntityMetadata | null;\n creator?: UserData;\n user_count?: number;\n image?: string | null;\n}\n\n// ─── Stage Instances ─────────────────────────────────────────────────────────\n\n/** Raw Discord stage instance object. */\nexport interface APIStageInstance {\n id: Snowflake;\n guild_id: Snowflake;\n channel_id: Snowflake;\n topic: string;\n privacy_level: number;\n discoverable_disabled?: boolean;\n guild_scheduled_event_id?: Snowflake | null;\n}\n\n// ─── Application Commands ─────────────────────────────────────────────────────\n\n/** Discord application command option types. */\nexport const ApplicationCommandOptionType = {\n SubCommand: 1,\n SubCommandGroup: 2,\n String: 3,\n Integer: 4,\n Boolean: 5,\n User: 6,\n Channel: 7,\n Role: 8,\n Mentionable: 9,\n Number: 10,\n Attachment: 11,\n} as const;\n\n/** Discord application command types. */\nexport const ApplicationCommandType = {\n ChatInput: 1,\n User: 2,\n Message: 3,\n} as const;\n\n/** Raw Discord application command option. */\nexport interface APIApplicationCommandOption {\n type: number;\n name: string;\n description: string;\n required?: boolean;\n choices?: Array<{ name: string; value: string | number }>;\n options?: APIApplicationCommandOption[];\n min_value?: number;\n max_value?: number;\n min_length?: number;\n max_length?: number;\n autocomplete?: boolean;\n channel_types?: number[];\n}\n\n/** Raw Discord application command object (from API). */\nexport interface APIApplicationCommand {\n id: Snowflake;\n type?: number;\n application_id: Snowflake;\n guild_id?: Snowflake;\n name: string;\n description: string;\n options?: APIApplicationCommandOption[];\n default_member_permissions?: string | null;\n dm_permission?: boolean;\n nsfw?: boolean;\n version: Snowflake;\n}\n\n/** Data for creating/overwriting an application command. */\nexport interface ApplicationCommandData {\n name: string;\n description: string;\n type?: number;\n options?: APIApplicationCommandOption[];\n default_member_permissions?: string | null;\n dm_permission?: boolean;\n nsfw?: boolean;\n}\n"
5
+ "// ─── Gateway Intents ─────────────────────────────────────────────────────────\n\n/** Gateway intent bit flags supported by Discord (PascalCase). */\nexport const GatewayIntentBits = {\n Guilds: 1 << 0,\n GuildMembers: 1 << 1,\n GuildModeration: 1 << 2,\n GuildExpressions: 1 << 3,\n GuildIntegrations: 1 << 4,\n GuildWebhooks: 1 << 5,\n GuildInvites: 1 << 6,\n GuildVoiceStates: 1 << 7,\n GuildPresences: 1 << 8,\n GuildMessages: 1 << 9,\n GuildMessageReactions: 1 << 10,\n GuildMessageTyping: 1 << 11,\n DirectMessages: 1 << 12,\n DirectMessageReactions: 1 << 13,\n DirectMessageTyping: 1 << 14,\n MessageContent: 1 << 15,\n GuildScheduledEvents: 1 << 16,\n AutoModerationConfiguration: 1 << 20,\n AutoModerationExecution: 1 << 21,\n GuildMessagePolls: 1 << 24,\n DirectMessagePolls: 1 << 25,\n} as const;\n\n/** Idiomatic camelCase Gateway intent bit flags supported by Discord. */\nexport const IntentBits = {\n guild: 1 << 0,\n guilds: 1 << 0,\n guildMembers: 1 << 1,\n guildModeration: 1 << 2,\n guildBans: 1 << 2,\n guildExpressions: 1 << 3,\n guildEmojis: 1 << 3,\n guildEmojisAndStickers: 1 << 3,\n guildIntegrations: 1 << 4,\n guildWebhooks: 1 << 5,\n guildInvites: 1 << 6,\n guildVoiceStates: 1 << 7,\n guildPresences: 1 << 8,\n guildMessages: 1 << 9,\n guildMessage: 1 << 9,\n guildMessageReactions: 1 << 10,\n guildMessageTyping: 1 << 11,\n directMessages: 1 << 12,\n directMessageReactions: 1 << 13,\n directMessageTyping: 1 << 14,\n messageContent: 1 << 15,\n guildScheduledEvents: 1 << 16,\n autoModerationConfiguration: 1 << 20,\n autoModerationExecution: 1 << 21,\n guildMessagePolls: 1 << 24,\n directMessagePolls: 1 << 25,\n} as const;\n\n/** Alias for IntentBits. */\nexport const Intents = IntentBits;\n\n/** Gateway intent resolvable value (single bitfield, enum key, or array of bitfields/strings). */\nexport type GatewayIntentResolvable =\n | number\n | keyof typeof GatewayIntentBits\n | keyof typeof IntentBits\n | (\n | number\n | keyof typeof GatewayIntentBits\n | keyof typeof IntentBits\n | string\n )[]\n | { readonly bitfield: number };\n\n/** Resolves any GatewayIntentResolvable into a raw bitfield integer. */\nexport function resolveGatewayIntents(\n intents: GatewayIntentResolvable,\n): number {\n if (typeof intents === \"number\") return intents;\n if (intents && typeof intents === \"object\" && !Array.isArray(intents))\n return intents.bitfield;\n if (Array.isArray(intents)) {\n return intents.reduce<number>((acc, intent) => {\n return acc | resolveGatewayIntents(intent as any);\n }, 0);\n }\n if (typeof intents === \"string\") {\n if (intents in GatewayIntentBits)\n return (GatewayIntentBits as Record<string, number>)[intents]!;\n if (intents in IntentBits)\n return (IntentBits as Record<string, number>)[intents]!;\n const lower = intents.charAt(0).toLowerCase() + intents.slice(1);\n if (lower in IntentBits)\n return (IntentBits as Record<string, number>)[lower]!;\n const num = Number(intents);\n if (!Number.isNaN(num)) return num;\n }\n return 0;\n}\n\n/**\n * Discord.js-familiar intent bitfield.\n * @example new IntentsBitField([IntentsBitField.Flags.Guilds, \"GuildMessages\"])\n */\nexport class IntentsBitField {\n /** Intent flag values by name. */\n public static readonly Flags = GatewayIntentBits;\n /** Raw intent bitfield. */\n public bitfield: number;\n\n public constructor(bits: GatewayIntentResolvable = 0) {\n this.bitfield = resolveGatewayIntents(bits);\n }\n\n /** Whether every given intent is set. */\n public has(bits: GatewayIntentResolvable): boolean {\n const resolved = resolveGatewayIntents(bits);\n return (this.bitfield & resolved) === resolved;\n }\n\n /** Whether any given intent is set. */\n public any(bits: GatewayIntentResolvable): boolean {\n return (this.bitfield & resolveGatewayIntents(bits)) !== 0;\n }\n\n /** Adds intents in place. @returns This bitfield. */\n public add(...bits: GatewayIntentResolvable[]): this {\n for (const bit of bits) this.bitfield |= resolveGatewayIntents(bit);\n return this;\n }\n\n /** Removes intents in place. @returns This bitfield. */\n public remove(...bits: GatewayIntentResolvable[]): this {\n for (const bit of bits) this.bitfield &= ~resolveGatewayIntents(bit);\n return this;\n }\n\n /** Names of the set intents. */\n public toArray(): (keyof typeof GatewayIntentBits)[] {\n return (\n Object.keys(GatewayIntentBits) as (keyof typeof GatewayIntentBits)[]\n ).filter((name) => this.has(GatewayIntentBits[name]));\n }\n\n /** Whether this equals another bitfield. */\n public equals(bits: GatewayIntentResolvable): boolean {\n return this.bitfield === resolveGatewayIntents(bits);\n }\n\n public valueOf(): number {\n return this.bitfield;\n }\n\n public toJSON(): number {\n return this.bitfield;\n }\n}\n\n// ─── Gateway Config ───────────────────────────────────────────────────────────\n\n/** Gateway connection properties (OS, browser, device). */\nexport interface GatewayProperties {\n os?: string;\n browser?: string;\n device?: string;\n [key: string]: unknown;\n}\n/** Gateway presence activity. */\nexport interface GatewayPresenceActivity {\n name: string;\n type?: number;\n url?: string;\n state?: string;\n}\n/** Gateway presence data. */\nexport interface GatewayPresence {\n status?: \"online\" | \"dnd\" | \"idle\" | \"invisible\" | \"offline\";\n activities?: GatewayPresenceActivity[];\n afk?: boolean;\n since?: number | null;\n}\n/** Client configuration. */\nexport interface ClientOptions {\n token: string;\n intents: GatewayIntentResolvable;\n gateway?: GatewayOptions;\n rest?: RESTOptions;\n /** Opt-in bounded per-channel message cache. Messages are not cached by default. */\n messageCache?: { maxSize?: number; ttl?: number };\n /**\n * Which resources the client keeps from Gateway events. Everything is\n * cached by default; large bots can turn off what they do not read.\n * Events are still emitted either way.\n */\n cache?: {\n users?: boolean;\n members?: boolean;\n roles?: boolean;\n emojis?: boolean;\n };\n}\n/** Gateway connection configuration. */\nexport interface GatewayOptions {\n intents?: GatewayIntentResolvable;\n reconnect?: boolean;\n maxReconnectAttempts?: number;\n reconnectBaseDelay?: number;\n reconnectMaxDelay?: number;\n shardId?: number;\n shardCount?: number;\n properties?: GatewayProperties;\n presence?: GatewayPresence;\n}\n\n/** REST request configuration. */\nexport interface RESTOptions {\n timeout?: number;\n retries?: number;\n baseURL?: string;\n}\n",
6
+ "/** Discord API snowflake identifier. */\nexport type Snowflake = string;\n\nexport * from \"./gateway.js\";\nexport * from \"./gateway-events.js\";\n\n// ─── Core Discord Objects ─────────────────────────────────────────────────────\n\n/** Discord user object. */\nexport interface UserData {\n id: Snowflake;\n username: string;\n discriminator?: string;\n global_name?: string | null;\n avatar?: string | null;\n bot?: boolean;\n system?: boolean;\n public_flags?: number;\n}\n/** Current authenticated bot user. */\nexport type ClientUser = UserData;\n/** Discord Gateway payload envelope. */\nexport interface GatewayPayload<T = unknown> {\n op: number;\n d: T | null;\n s: number | null;\n t: string | null;\n}\n/** Generic Discord API error payload. */\nexport interface APIError {\n code?: number;\n message?: string;\n errors?: Record<string, unknown>;\n}\n\n// ─── Discord Flags & Enums ────────────────────────────────────────────────────\n\n/** Discord message flags. */\nexport const MessageFlags = {\n Crossposted: 1,\n IsCrosspost: 2,\n SuppressEmbeds: 4,\n SourceMessageDeleted: 8,\n Urgent: 16,\n HasThread: 32,\n Ephemeral: 64,\n Loading: 128,\n IsComponentsV2: 32768,\n} as const;\n/** One {@link MessageFlags} value, usable as a type. */\nexport type MessageFlags = (typeof MessageFlags)[keyof typeof MessageFlags];\n\n/** Discord channel types. */\nexport const ChannelType = {\n GuildText: 0,\n DM: 1,\n GuildVoice: 2,\n GroupDM: 3,\n GuildCategory: 4,\n GuildAnnouncement: 5,\n AnnouncementThread: 10,\n PublicThread: 11,\n PrivateThread: 12,\n GuildStageVoice: 13,\n GuildDirectory: 14,\n GuildForum: 15,\n GuildMedia: 16,\n} as const;\n\n/** Discord component types. */\nexport const ComponentType = {\n ActionRow: 1,\n Button: 2,\n StringSelect: 3,\n TextInput: 4,\n UserSelect: 5,\n RoleSelect: 6,\n MentionableSelect: 7,\n ChannelSelect: 8,\n Section: 9,\n TextDisplay: 10,\n Thumbnail: 11,\n MediaGallery: 12,\n File: 13,\n Separator: 14,\n ContentInventoryEntry: 16,\n Container: 17,\n} as const;\n/** One {@link ComponentType} value, usable as a type. */\nexport type ComponentType = (typeof ComponentType)[keyof typeof ComponentType];\n\n/** Discord button style types. */\nexport const ButtonStyle = {\n Primary: 1,\n Secondary: 2,\n Success: 3,\n Danger: 4,\n Link: 5,\n Premium: 6,\n} as const;\n/** One {@link ButtonStyle} value, usable as a type: `style: ButtonStyle`. */\nexport type ButtonStyle = (typeof ButtonStyle)[keyof typeof ButtonStyle];\n\n/** Discord text input style types. */\nexport const TextInputStyle = {\n Short: 1,\n Paragraph: 2,\n} as const;\n/** One {@link TextInputStyle} value, usable as a type. */\nexport type TextInputStyle =\n (typeof TextInputStyle)[keyof typeof TextInputStyle];\n\n/** Discord interaction response types. */\nexport const InteractionResponseType = {\n Pong: 1,\n ChannelMessage: 4,\n DeferredChannelMessage: 5,\n DeferredMessageUpdate: 6,\n MessageUpdate: 7,\n Autocomplete: 8,\n Modal: 9,\n} as const;\n\n/** Discord sticker format types. */\nexport const StickerFormatType = {\n PNG: 1,\n APNG: 2,\n Lottie: 3,\n GIF: 4,\n} as const;\n\n/** Discord sticker types. */\nexport const StickerType = {\n Standard: 1,\n Guild: 2,\n} as const;\n\n/** Discord verification levels. */\nexport const VerificationLevel = {\n None: 0,\n Low: 1,\n Medium: 2,\n High: 3,\n VeryHigh: 4,\n} as const;\n\n/** Discord premium tiers. */\nexport const PremiumTier = {\n None: 0,\n Tier1: 1,\n Tier2: 2,\n Tier3: 3,\n} as const;\n\n// ─── Embeds ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord embed footer object. */\nexport interface APIEmbedFooter {\n text: string;\n icon_url?: string;\n proxy_icon_url?: string;\n}\n/** Raw Discord embed image/thumbnail/video object. */\nexport interface APIEmbedMedia {\n url: string;\n proxy_url?: string;\n height?: number;\n width?: number;\n}\n/** Raw Discord embed provider object. */\nexport interface APIEmbedProvider {\n name?: string;\n url?: string;\n}\n/** Raw Discord embed author object. */\nexport interface APIEmbedAuthor {\n name: string;\n url?: string;\n icon_url?: string;\n proxy_icon_url?: string;\n}\n/** Raw Discord embed field object. */\nexport interface APIEmbedField {\n name: string;\n value: string;\n inline?: boolean;\n}\n/** Raw Discord embed object. */\nexport interface APIEmbed {\n title?: string;\n type?: string;\n description?: string;\n url?: string;\n timestamp?: string;\n color?: number;\n footer?: APIEmbedFooter;\n image?: APIEmbedMedia;\n thumbnail?: APIEmbedMedia;\n video?: APIEmbedMedia;\n provider?: APIEmbedProvider;\n author?: APIEmbedAuthor;\n fields?: APIEmbedField[];\n}\n\n// ─── Message Components ───────────────────────────────────────────────────────\n\n/** Raw Discord select menu option. */\nexport interface APISelectMenuOption {\n label: string;\n value: string;\n description?: string;\n emoji?: APIPartialEmoji;\n default?: boolean;\n}\n/** Raw Discord emoji (partial, as used in components). */\nexport interface APIPartialEmoji {\n id?: Snowflake | null;\n name?: string | null;\n animated?: boolean;\n}\n/** Raw Discord button component. */\nexport interface APIButtonComponent {\n type: 2;\n style: number;\n label?: string;\n emoji?: APIPartialEmoji;\n custom_id?: string;\n url?: string;\n sku_id?: string;\n disabled?: boolean;\n}\n/** Raw Discord select menu component. */\nexport interface APISelectMenuComponent {\n type: 3 | 5 | 6 | 7 | 8;\n custom_id: string;\n options?: APISelectMenuOption[];\n channel_types?: number[];\n placeholder?: string;\n min_values?: number;\n max_values?: number;\n disabled?: boolean;\n}\n/** Raw Discord text input component. */\nexport interface APITextInputComponent {\n type: 4;\n custom_id: string;\n style: number;\n label: string;\n min_length?: number;\n max_length?: number;\n required?: boolean;\n value?: string;\n placeholder?: string;\n}\n/** Union of all raw message component types. */\nexport type APIMessageActionRowComponent =\n APIButtonComponent | APISelectMenuComponent | APITextInputComponent;\n/** Raw Discord action row component. */\nexport interface APIActionRowComponent {\n type: 1;\n id?: number;\n components: APIMessageActionRowComponent[];\n}\n/** Union including action rows and V2 components. */\nexport type APIMessageComponent =\n APIActionRowComponent | { type: Exclude<number, 1>; [key: string]: any };\n\n// ─── Attachments ─────────────────────────────────────────────────────────────\n\n/** Raw Discord attachment object. */\nexport interface APIAttachment {\n id: Snowflake;\n filename: string;\n description?: string | null;\n content_type?: string;\n size: number;\n url: string;\n proxy_url: string;\n height?: number | null;\n width?: number | null;\n ephemeral?: boolean;\n duration_secs?: number;\n waveform?: string;\n flags?: number;\n}\n\n// ─── Stickers ────────────────────────────────────────────────────────────────\n\n/** Compact sticker item as included in messages. */\nexport interface APIStickerItem {\n id: Snowflake;\n name: string;\n format_type: number;\n}\n/** Full Discord sticker object. */\nexport interface APISticker {\n id: Snowflake;\n pack_id?: Snowflake;\n name: string;\n description?: string | null;\n tags?: string;\n type: number;\n format_type: number;\n available?: boolean;\n guild_id?: Snowflake;\n user?: UserData;\n sort_value?: number;\n}\n\n// ─── Messages ────────────────────────────────────────────────────────────────\n\n/** Raw Discord message reference. */\nexport interface APIMessageReference {\n type?: number;\n message_id?: Snowflake;\n channel_id?: Snowflake;\n guild_id?: Snowflake;\n fail_if_not_exists?: boolean;\n}\n/** Raw Discord message reaction. */\nexport interface APIMessageReaction {\n count: number;\n count_details?: Record<string, number>;\n me?: boolean;\n me_burst?: boolean;\n emoji: APIPartialEmoji;\n burst_colors?: string[];\n}\n/** Raw Discord message object. */\nexport interface APIMessage {\n id: Snowflake;\n channel_id: Snowflake;\n author: UserData;\n content: string;\n timestamp?: string;\n edited_timestamp?: string | null;\n tts?: boolean;\n mention_everyone?: boolean;\n mentions?: UserData[];\n mention_roles?: Snowflake[];\n mention_channels?: Array<Record<string, unknown>>;\n attachments?: APIAttachment[];\n embeds?: APIEmbed[];\n reactions?: APIMessageReaction[];\n nonce?: string | number | null;\n pinned?: boolean;\n webhook_id?: Snowflake;\n type?: number;\n activity?: Record<string, unknown>;\n application?: Record<string, unknown>;\n application_id?: Snowflake;\n message_reference?: APIMessageReference;\n flags?: number;\n referenced_message?: APIMessage | null;\n interaction_metadata?: Record<string, unknown>;\n thread?: Record<string, unknown>;\n components?: APIMessageComponent[];\n sticker_items?: APIStickerItem[];\n stickers?: APISticker[];\n position?: number;\n role_subscription_data?: Record<string, unknown>;\n purchase_notification?: Record<string, unknown>;\n poll?: Record<string, unknown>;\n guild_id?: Snowflake;\n /** The author's guild member, on guild messages from the Gateway (without `user`; the author is the user). */\n member?: Omit<APIGuildMember, \"user\"> & { user?: UserData };\n}\n\n// ─── Channels ────────────────────────────────────────────────────────────────\n\n/** Raw Discord channel object. */\nexport interface APIChannel {\n id: Snowflake;\n type: number;\n guild_id?: Snowflake;\n position?: number;\n permission_overwrites?: APIOverwrite[];\n name?: string | null;\n topic?: string | null;\n nsfw?: boolean;\n last_message_id?: Snowflake | null;\n bitrate?: number;\n user_limit?: number;\n rate_limit_per_user?: number;\n recipients?: UserData[];\n icon?: string | null;\n owner_id?: Snowflake;\n application_id?: Snowflake;\n parent_id?: Snowflake | null;\n last_pin_timestamp?: string | null;\n rtc_region?: string | null;\n video_quality_mode?: number;\n message_count?: number;\n member_count?: number;\n thread_metadata?: APIThreadMetadata;\n default_auto_archive_duration?: number;\n flags?: number;\n total_message_sent?: number;\n available_tags?: APIForumTag[];\n default_reaction_emoji?: APIPartialEmoji | null;\n default_thread_rate_limit_per_user?: number;\n default_sort_order?: number | null;\n default_forum_layout?: number;\n}\n\n/** Raw Discord thread metadata. */\nexport interface APIThreadMetadata {\n archived: boolean;\n auto_archive_duration: number;\n archive_timestamp: string;\n locked: boolean;\n invitable?: boolean;\n create_timestamp?: string | null;\n}\n\n/** Raw Discord forum tag. */\nexport interface APIForumTag {\n id: Snowflake;\n name: string;\n moderated: boolean;\n emoji_id?: Snowflake | null;\n emoji_name?: string | null;\n}\n\n/** Raw Discord thread member. */\nexport interface APIThreadMember {\n id?: Snowflake;\n user_id?: Snowflake;\n join_timestamp: string;\n flags: number;\n member?: APIGuildMember;\n}\n\n// ─── Roles ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord role object. */\nexport interface APIRole {\n id: Snowflake;\n name: string;\n color: number;\n hoist: boolean;\n icon?: string | null;\n unicode_emoji?: string | null;\n position: number;\n permissions: string;\n managed: boolean;\n mentionable: boolean;\n tags?: Record<string, unknown>;\n flags?: number;\n}\n\n// ─── Emoji ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord emoji object. */\nexport interface APIEmoji {\n id: Snowflake | null;\n name: string | null;\n roles?: Snowflake[];\n user?: UserData;\n require_colons?: boolean;\n managed?: boolean;\n animated?: boolean;\n available?: boolean;\n}\n\n// ─── Guilds ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord guild object. */\nexport interface APIGuild {\n id: Snowflake;\n name: string;\n icon?: string | null;\n icon_hash?: string | null;\n splash?: string | null;\n discovery_splash?: string | null;\n owner?: boolean;\n owner_id?: Snowflake;\n permissions?: string;\n afk_channel_id?: Snowflake | null;\n afk_timeout?: number;\n widget_enabled?: boolean;\n widget_channel_id?: Snowflake | null;\n verification_level?: number;\n default_message_notifications?: number;\n explicit_content_filter?: number;\n roles?: APIRole[];\n emojis?: APIEmoji[];\n stickers?: APISticker[];\n features?: string[];\n mfa_level?: number;\n application_id?: Snowflake | null;\n system_channel_id?: Snowflake | null;\n system_channel_flags?: number;\n rules_channel_id?: Snowflake | null;\n max_presences?: number | null;\n max_members?: number;\n vanity_url_code?: string | null;\n description?: string | null;\n banner?: string | null;\n premium_tier?: number;\n premium_subscription_count?: number;\n preferred_locale?: string;\n public_updates_channel_id?: Snowflake | null;\n max_video_channel_users?: number;\n approximate_member_count?: number;\n approximate_presence_count?: number;\n nsfw_level?: number;\n safety_alerts_channel_id?: Snowflake | null;\n member_count?: number;\n}\n\n// ─── Welcome Screen ───────────────────────────────────────────────────────────\n\nexport interface APIWelcomeScreenChannel {\n channel_id: Snowflake;\n description: string;\n emoji_id: Snowflake | null;\n emoji_name: string | null;\n}\n\nexport interface APIGuildWelcomeScreen {\n description: string | null;\n welcome_channels: APIWelcomeScreenChannel[];\n}\n\n// ─── Guild Onboarding ─────────────────────────────────────────────────────────\n\nexport interface APIOnboardingPromptOption {\n id: Snowflake;\n channel_ids: Snowflake[];\n role_ids: Snowflake[];\n emoji?: APIPartialEmoji;\n title: string;\n description: string | null;\n}\n\nexport interface APIOnboardingPrompt {\n id: Snowflake;\n type: number;\n options: APIOnboardingPromptOption[];\n title: string;\n single_select: boolean;\n required: boolean;\n in_onboarding: boolean;\n}\n\nexport interface APIGuildOnboarding {\n guild_id: Snowflake;\n prompts: APIOnboardingPrompt[];\n default_channel_ids: Snowflake[];\n enabled: boolean;\n mode: number;\n}\n\n/** Raw Discord guild member object. */\nexport interface APIGuildMember {\n user: UserData;\n nick?: string | null;\n avatar?: string | null;\n roles: Snowflake[];\n joined_at: string;\n premium_since?: string | null;\n deaf?: boolean;\n mute?: boolean;\n flags?: number;\n pending?: boolean;\n permissions?: string;\n communication_disabled_until?: string | null;\n guild_id?: Snowflake;\n}\n\n// ─── Voice ────────────────────────────────────────────────────────────────────\n\n/** Raw Discord voice state object. */\nexport interface APIVoiceState {\n guild_id?: Snowflake;\n channel_id?: Snowflake | null;\n user_id: Snowflake;\n member?: APIGuildMember;\n session_id: string;\n deaf: boolean;\n mute: boolean;\n self_deaf: boolean;\n self_mute: boolean;\n self_stream?: boolean;\n self_video: boolean;\n suppress: boolean;\n request_to_speak_timestamp?: string | null;\n}\n\n/** Raw Discord voice server update event. */\nexport interface APIVoiceServerUpdate {\n token: string;\n guild_id: Snowflake;\n endpoint?: string | null;\n}\n\n// ─── Presence ────────────────────────────────────────────────────────────────\n\n/** Raw Discord activity object. */\nexport interface APIActivity {\n name: string;\n type: number;\n url?: string | null;\n created_at: number;\n state?: string | null;\n details?: string | null;\n emoji?: APIPartialEmoji | null;\n}\n\n/** Raw Discord presence update event. */\nexport interface APIPresenceUpdate {\n user: { id: Snowflake } & Partial<UserData>;\n guild_id: Snowflake;\n status: string;\n activities: APIActivity[];\n client_status: { desktop?: string; mobile?: string; web?: string };\n}\n\n// ─── Typing ───────────────────────────────────────────────────────────────────\n\n/** Raw Discord typing start event. */\nexport interface APITypingStart {\n channel_id: Snowflake;\n guild_id?: Snowflake;\n user_id: Snowflake;\n timestamp: number;\n member?: APIGuildMember;\n}\n\n// ─── Guilds ──────────────────────────────────────────────────────────────────\n\n/** Raw Discord guild preview. */\nexport interface APIGuildPreview {\n id: Snowflake;\n name: string;\n icon: string | null;\n splash: string | null;\n discovery_splash: string | null;\n emojis: unknown[];\n features: string[];\n approximate_member_count: number;\n approximate_presence_count: number;\n description: string | null;\n stickers: unknown[];\n}\n\n// ─── Invites ─────────────────────────────────────────────────────────────────\n\n/** Raw Discord invite. */\nexport interface APIInvite {\n code: string;\n guild?: Partial<APIGuild>;\n channel: Partial<APIChannel>;\n inviter?: UserData;\n target_type?: number;\n target_user?: UserData;\n approximate_presence_count?: number;\n approximate_member_count?: number;\n}\n\n/** Raw Discord invite create event. */\nexport interface APIInviteCreate {\n channel_id: Snowflake;\n code: string;\n created_at: string;\n guild_id?: Snowflake;\n inviter?: UserData;\n max_age: number;\n max_uses: number;\n target_type?: number;\n target_user?: UserData;\n temporary: boolean;\n uses: number;\n}\n\n/** Raw Discord invite delete event. */\nexport interface APIInviteDelete {\n channel_id: Snowflake;\n guild_id?: Snowflake;\n code: string;\n}\n\n// ─── Webhooks ────────────────────────────────────────────────────────────────\n\n/** Raw Discord webhooks update event. */\nexport interface APIWebhooksUpdate {\n guild_id: Snowflake;\n channel_id: Snowflake;\n}\n\n/** Raw Discord webhook object. */\nexport interface APIWebhook {\n id: Snowflake;\n type: number;\n guild_id?: Snowflake | null;\n channel_id?: Snowflake | null;\n user?: UserData;\n name?: string | null;\n avatar?: string | null;\n token?: string;\n application_id?: Snowflake | null;\n url?: string;\n}\n\n// ─── AutoMod ─────────────────────────────────────────────────────────────────\n\n/** Raw Discord AutoMod action. */\nexport interface APIAutoModerationAction {\n type: number;\n metadata?: {\n channel_id?: Snowflake;\n duration_seconds?: number;\n custom_message?: string;\n };\n}\n\n// ─── Audit Logs ──────────────────────────────────────────────────────────────\n\n/** Raw Discord audit log change object. */\nexport interface APIAuditLogChange {\n new_value?: unknown;\n old_value?: unknown;\n key: string;\n}\n\n/** Raw Discord audit log entry options object. */\nexport interface APIAuditLogOptions {\n app_id?: Snowflake;\n auto_moderation_rule_name?: string;\n auto_moderation_rule_trigger_type?: string;\n channel_id?: Snowflake;\n count?: string;\n delete_member_days?: string;\n id?: Snowflake;\n members_removed?: string;\n message_id?: Snowflake;\n role_name?: string;\n type?: string;\n integration_type?: string;\n}\n\n/** Raw Discord audit log entry object. */\nexport interface APIAuditLogEntry {\n target_id: string | null;\n changes?: APIAuditLogChange[];\n user_id: Snowflake | null;\n id: Snowflake;\n action_type: number;\n options?: APIAuditLogOptions;\n reason?: string;\n}\n\n/** Raw Discord audit log object. */\nexport interface APIAuditLog {\n audit_log_entries: APIAuditLogEntry[];\n guild_scheduled_events: APIGuildScheduledEvent[];\n integrations: Array<Record<string, unknown>>;\n threads: APIChannel[];\n users: UserData[];\n webhooks: APIWebhook[];\n application_commands: APIApplicationCommand[];\n auto_moderation_rules: APIAutoModerationRule[];\n}\n\n/** Raw Discord AutoMod rule object. */\nexport interface APIAutoModerationRule {\n id: Snowflake;\n guild_id: Snowflake;\n name: string;\n creator_id: Snowflake;\n event_type: number;\n trigger_type: number;\n trigger_metadata: Record<string, unknown>;\n actions: APIAutoModerationAction[];\n enabled: boolean;\n exempt_roles: Snowflake[];\n exempt_channels: Snowflake[];\n}\n\n/** Raw Discord AutoMod action execution event. */\nexport interface APIAutoModerationActionExecution {\n guild_id: Snowflake;\n action: APIAutoModerationAction;\n rule_id: Snowflake;\n rule_trigger_type: number;\n user_id: Snowflake;\n channel_id?: Snowflake;\n message_id?: Snowflake;\n alert_system_message_id?: Snowflake;\n content: string;\n matched_keyword?: string | null;\n matched_content?: string | null;\n}\n\n// ─── Scheduled Events ─────────────────────────────────────────────────────────\n\n/** Raw Discord guild scheduled event entity metadata. */\nexport interface APIGuildScheduledEventEntityMetadata {\n location?: string;\n}\n\n/** Raw Discord guild scheduled event object. */\nexport interface APIGuildScheduledEvent {\n id: Snowflake;\n guild_id: Snowflake;\n channel_id?: Snowflake | null;\n creator_id?: Snowflake | null;\n name: string;\n description?: string | null;\n scheduled_start_time: string;\n scheduled_end_time?: string | null;\n privacy_level: number;\n status: number;\n entity_type: number;\n entity_id?: Snowflake | null;\n entity_metadata?: APIGuildScheduledEventEntityMetadata | null;\n creator?: UserData;\n user_count?: number;\n image?: string | null;\n}\n\n// ─── Stage Instances ─────────────────────────────────────────────────────────\n\n/** Raw Discord stage instance object. */\nexport interface APIStageInstance {\n id: Snowflake;\n guild_id: Snowflake;\n channel_id: Snowflake;\n topic: string;\n privacy_level: number;\n discoverable_disabled?: boolean;\n guild_scheduled_event_id?: Snowflake | null;\n}\n\n// ─── Application Commands ─────────────────────────────────────────────────────\n\n/** Discord application command option types. */\nexport const ApplicationCommandOptionType = {\n SubCommand: 1,\n SubCommandGroup: 2,\n String: 3,\n Integer: 4,\n Boolean: 5,\n User: 6,\n Channel: 7,\n Role: 8,\n Mentionable: 9,\n Number: 10,\n Attachment: 11,\n} as const;\n\n/** Discord application command types. */\nexport const ApplicationCommandType = {\n ChatInput: 1,\n User: 2,\n Message: 3,\n} as const;\n\n/** Raw Discord application command option. */\nexport interface APIApplicationCommandOption {\n type: number;\n name: string;\n description: string;\n required?: boolean;\n choices?: Array<{ name: string; value: string | number }>;\n options?: APIApplicationCommandOption[];\n min_value?: number;\n max_value?: number;\n min_length?: number;\n max_length?: number;\n autocomplete?: boolean;\n channel_types?: number[];\n}\n\n/** Raw Discord application command object (from API). */\nexport interface APIApplicationCommand {\n id: Snowflake;\n type?: number;\n application_id: Snowflake;\n guild_id?: Snowflake;\n name: string;\n description: string;\n options?: APIApplicationCommandOption[];\n default_member_permissions?: string | null;\n dm_permission?: boolean;\n nsfw?: boolean;\n version: Snowflake;\n}\n\n/** Data for creating/overwriting an application command. */\nexport interface ApplicationCommandData {\n name: string;\n description: string;\n type?: number;\n options?: APIApplicationCommandOption[];\n default_member_permissions?: string | null;\n dm_permission?: boolean;\n nsfw?: boolean;\n}\n\n/** A channel permission overwrite for a role (type 0) or member (type 1). */\nexport interface APIOverwrite {\n id: Snowflake;\n type: 0 | 1;\n /** Allowed permission bits as a decimal string. */\n allow: string;\n /** Denied permission bits as a decimal string. */\n deny: string;\n}\n\n// ─── Soundboard & Monetization ───────────────────────────────────────────────\n/** Raw Discord soundboard sound. */\nexport interface APISoundboardSound {\n sound_id: string;\n name: string;\n volume: number;\n emoji_id: string | null;\n emoji_name: string | null;\n guild_id?: string;\n available: boolean;\n user?: UserData;\n}\n\n/** Raw Discord SKU. */\nexport interface APISKU {\n id: string;\n type: number;\n application_id: string;\n name: string;\n slug: string;\n flags: number;\n}\n\n/** Raw Discord entitlement. */\nexport interface APIEntitlement {\n id: string;\n sku_id: string;\n application_id: string;\n user_id?: string;\n guild_id?: string;\n type: number;\n deleted: boolean;\n starts_at?: string | null;\n ends_at?: string | null;\n consumed?: boolean;\n}\n\n/** Raw Discord subscription. */\nexport interface APISubscription {\n id: string;\n user_id: string;\n sku_ids: string[];\n entitlement_ids: string[];\n current_period_start: string;\n current_period_end: string;\n status: number;\n canceled_at: string | null;\n country?: string;\n}\n"
7
7
  ],
8
- "mappings": ";;AAGO,IAAM,oBAAoB;AAAA,EAC7B,QAAQ,KAAK;AAAA,EACb,cAAc,KAAK;AAAA,EACnB,iBAAiB,KAAK;AAAA,EACtB,kBAAkB,KAAK;AAAA,EACvB,mBAAmB,KAAK;AAAA,EACxB,eAAe,KAAK;AAAA,EACpB,cAAc,KAAK;AAAA,EACnB,kBAAkB,KAAK;AAAA,EACvB,gBAAgB,KAAK;AAAA,EACrB,eAAe,KAAK;AAAA,EACpB,uBAAuB,KAAK;AAAA,EAC5B,oBAAoB,KAAK;AAAA,EACzB,gBAAgB,KAAK;AAAA,EACrB,wBAAwB,KAAK;AAAA,EAC7B,qBAAqB,KAAK;AAAA,EAC1B,gBAAgB,KAAK;AAAA,EACrB,sBAAsB,KAAK;AAAA,EAC3B,6BAA6B,KAAK;AAAA,EAClC,yBAAyB,KAAK;AAAA,EAC9B,mBAAmB,KAAK;AAAA,EACxB,oBAAoB,KAAK;AAC7B;AAGO,IAAM,aAAa;AAAA,EACtB,OAAO,KAAK;AAAA,EACZ,QAAQ,KAAK;AAAA,EACb,cAAc,KAAK;AAAA,EACnB,iBAAiB,KAAK;AAAA,EACtB,WAAW,KAAK;AAAA,EAChB,kBAAkB,KAAK;AAAA,EACvB,aAAa,KAAK;AAAA,EAClB,wBAAwB,KAAK;AAAA,EAC7B,mBAAmB,KAAK;AAAA,EACxB,eAAe,KAAK;AAAA,EACpB,cAAc,KAAK;AAAA,EACnB,kBAAkB,KAAK;AAAA,EACvB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-command arguments: split a message into arguments and read them as
3
+ * typed values, the way slash-command options are read.
4
+ */
5
+ /** What an argument is read as. `rest` takes everything left, as one string. */
6
+ export type PrefixArgType = "string" | "integer" | "number" | "boolean" | "user" | "role" | "channel" | "mentionable" | "rest";
7
+ /** One expected argument. */
8
+ export interface PrefixArgSpec {
9
+ name: string;
10
+ type: PrefixArgType;
11
+ required?: boolean;
12
+ /** For `string` and `rest`: the longest accepted value. */
13
+ maxLength?: number;
14
+ /** For `integer` and `number`: the accepted range. */
15
+ min?: number;
16
+ max?: number;
17
+ /** Accepted values (compared case-insensitively for strings). */
18
+ choices?: readonly (string | number)[];
19
+ }
20
+ /** A mentionable argument: which kind of mention it was. An unmarked ID reads as a user. */
21
+ export interface MentionableArg {
22
+ id: string;
23
+ type: "user" | "role";
24
+ }
25
+ export type PrefixArgValue = string | number | boolean | MentionableArg;
26
+ export type PrefixArgsResult = {
27
+ ok: true;
28
+ values: Record<string, PrefixArgValue | undefined>;
29
+ } | {
30
+ ok: false;
31
+ arg: string;
32
+ error: string;
33
+ };
34
+ /**
35
+ * Splits text into arguments on whitespace. "Double quotes" or 'single quotes'
36
+ * keep spaces inside one argument; a backslash escapes the next character.
37
+ * @example tokenizeArgs(`ban @user "being rude"`) // ["ban", "@user", "being rude"]
38
+ */
39
+ export declare function tokenizeArgs(input: string): string[];
40
+ /** The user ID in `<@id>`, `<@!id>` or a bare ID; null otherwise. */
41
+ export declare function parseUserMention(value: string): string | null;
42
+ /** The role ID in `<@&id>` or a bare ID; null otherwise. */
43
+ export declare function parseRoleMention(value: string): string | null;
44
+ /** The channel ID in `<#id>` or a bare ID; null otherwise. */
45
+ export declare function parseChannelMention(value: string): string | null;
46
+ /** A user or role mention; a bare ID reads as a user. Null otherwise. */
47
+ export declare function parseMentionable(value: string): MentionableArg | null;
48
+ /**
49
+ * Reads prefix-command arguments by position, as typed values. IDs come back
50
+ * as strings (user, role, channel); a mentionable says which it was. The first
51
+ * problem is reported, with the argument's name, instead of throwing.
52
+ * @param input The text after the command name, or already-split arguments.
53
+ * @param specs The expected arguments in order; a `rest` argument must be last.
54
+ * @example
55
+ * const result = parsePrefixArgs(`@user 10 spamming links`, [
56
+ * { name: "user", type: "user", required: true },
57
+ * { name: "minutes", type: "integer", min: 1, max: 40320 },
58
+ * { name: "reason", type: "rest" },
59
+ * ]);
60
+ * if (!result.ok) return message.reply(`\`${result.arg}\` ${result.error}.`);
61
+ */
62
+ export declare function parsePrefixArgs(input: string | readonly string[], specs: readonly PrefixArgSpec[]): PrefixArgsResult;
63
+ /**
64
+ * Argument specs from a slash command's options, so one definition serves both
65
+ * `/command` and the prefix command. Subcommands and attachments are left out.
66
+ * @param options The command's (or subcommand's) `options` as sent to Discord.
67
+ * @param restLast Read the last string option as the rest of the message (handy for reasons).
68
+ */
69
+ export declare function argsFromCommandOptions(options: readonly {
70
+ name: string;
71
+ type: number;
72
+ required?: boolean;
73
+ min_value?: number;
74
+ max_value?: number;
75
+ max_length?: number;
76
+ choices?: readonly {
77
+ value: string | number;
78
+ }[];
79
+ }[], restLast?: boolean): PrefixArgSpec[];
@@ -4,3 +4,4 @@ export declare function sleep(ms: number): Promise<void>;
4
4
  export declare function randomInt(min: number, max: number): number;
5
5
  /** Tests whether a value is a Discord snowflake-like ID. */
6
6
  export declare function isSnowflake(value: string): boolean;
7
+ export { tokenizeArgs, parsePrefixArgs, argsFromCommandOptions, parseUserMention, parseRoleMention, parseChannelMention, parseMentionable, type PrefixArgType, type PrefixArgSpec, type PrefixArgValue, type PrefixArgsResult, type MentionableArg, } from "./args.js";