lunibee 0.1.1 → 0.1.2

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 (67) hide show
  1. package/README.md +229 -11
  2. package/dist/builders/attachment.d.ts +20 -0
  3. package/dist/builders/commands.d.ts +118 -0
  4. package/dist/builders/components.d.ts +151 -0
  5. package/dist/builders/embed.d.ts +59 -0
  6. package/dist/builders/index.d.ts +5 -0
  7. package/dist/builders/index.js +828 -0
  8. package/dist/builders/index.js.map +13 -0
  9. package/dist/collection/cache.d.ts +37 -0
  10. package/dist/collection/index.d.ts +47 -0
  11. package/dist/collection/index.js +214 -0
  12. package/dist/collection/index.js.map +11 -0
  13. package/dist/core/client-state.d.ts +10 -0
  14. package/dist/core/collector.d.ts +27 -0
  15. package/dist/core/events.d.ts +5 -0
  16. package/dist/core/index.d.ts +111 -0
  17. package/dist/core/index.js +3188 -0
  18. package/dist/core/index.js.map +29 -0
  19. package/dist/core/permissions.d.ts +293 -0
  20. package/dist/formatters/index.d.ts +10 -0
  21. package/dist/formatters/index.js +43 -0
  22. package/dist/formatters/index.js.map +10 -0
  23. package/dist/handlers/index.d.ts +16 -0
  24. package/dist/handlers/index.js +37 -0
  25. package/dist/handlers/index.js.map +10 -0
  26. package/{src/index.ts → dist/index.d.ts} +2 -29
  27. package/dist/index.js +4182 -0
  28. package/dist/index.js.map +41 -0
  29. package/dist/managers/application.d.ts +28 -0
  30. package/dist/managers/base.d.ts +28 -0
  31. package/dist/managers/index.d.ts +96 -0
  32. package/dist/managers/index.js +947 -0
  33. package/dist/managers/index.js.map +22 -0
  34. package/dist/managers/member.d.ts +35 -0
  35. package/dist/managers/message.d.ts +25 -0
  36. package/dist/managers/role.d.ts +34 -0
  37. package/dist/managers/thread.d.ts +14 -0
  38. package/dist/rest/index.d.ts +49 -0
  39. package/dist/rest/index.js +344 -0
  40. package/dist/rest/index.js.map +12 -0
  41. package/dist/rest/routes.d.ts +44 -0
  42. package/dist/rest/types.d.ts +26 -0
  43. package/dist/rest/webhook.d.ts +40 -0
  44. package/dist/sharding/bus.d.ts +22 -0
  45. package/dist/sharding/index.d.ts +34 -0
  46. package/dist/sharding/index.js +732 -0
  47. package/dist/sharding/index.js.map +13 -0
  48. package/dist/structures/base.d.ts +75 -0
  49. package/dist/structures/index.d.ts +39 -0
  50. package/dist/structures/index.js +571 -0
  51. package/dist/structures/index.js.map +14 -0
  52. package/dist/structures/interactions.d.ts +136 -0
  53. package/dist/structures/permissions.d.ts +73 -0
  54. package/dist/structures/resources.d.ts +64 -0
  55. package/dist/types/index.d.ts +535 -0
  56. package/dist/types/index.js +132 -0
  57. package/dist/types/index.js.map +10 -0
  58. package/dist/utils/index.d.ts +6 -0
  59. package/dist/utils/index.js +18 -0
  60. package/dist/utils/index.js.map +10 -0
  61. package/dist/voice/index.d.ts +97 -0
  62. package/dist/voice/index.js +161 -0
  63. package/dist/voice/index.js.map +10 -0
  64. package/dist/ws/index.d.ts +76 -0
  65. package/dist/ws/index.js +582 -0
  66. package/dist/ws/index.js.map +11 -0
  67. package/package.json +113 -28
package/README.md CHANGED
@@ -1,11 +1,229 @@
1
- # @lunibee/lunibee
2
-
3
- > Part of the lunibee ecosystem.
4
-
5
- ## Basic use
6
-
7
- ```ts
8
- import { ... } from '@lunibee/lunibee';
9
-
10
- // Example basic usage
11
- ```
1
+ # Lunibee 🐝
2
+
3
+ A lightweight, Bun-first Discord API library for TypeScript.
4
+
5
+ ## Production-readiness status
6
+
7
+ Lunibee's production-readiness work is being developed on `feat/production-readiness`. **Do not use `master` for active development.**
8
+
9
+ The roadmap covers:
10
+
11
+ - strict package dependency boundaries and installability
12
+ - Discord Gateway lifecycle, heartbeat ACK handling, resume/reconnect, and zombie detection
13
+ - canonical resource caching and shared REST/Gateway hydration
14
+ - bucket-aware REST rate limits, retries, timeouts, and `AbortSignal` cancellation
15
+ - typed permissions and ergonomic interaction APIs
16
+ - compile-time-safe component and embed builders
17
+ - graceful client and shard shutdown
18
+ - public API documentation
19
+
20
+ ## Requirements
21
+
22
+ - [Bun](https://bun.sh/) for the supported runtime and package manager
23
+ - TypeScript for typed application development
24
+ - A Discord bot token for connecting to Discord
25
+
26
+ ## Installation
27
+
28
+ For repository development:
29
+
30
+ ```bash
31
+ bun install
32
+ ```
33
+
34
+ For application usage, install the published `lunibee` package when a release is available:
35
+
36
+ ```bash
37
+ bun add lunibee
38
+ ```
39
+
40
+ ## Getting started
41
+
42
+ ```ts
43
+ import { Client, GatewayIntentBits } from "lunibee";
44
+
45
+ const client = new Client({
46
+ token: process.env.DISCORD_TOKEN!,
47
+ intents: GatewayIntentBits.Guilds | GatewayIntentBits.GuildMessages
48
+ });
49
+
50
+ client.on("ready", user => {
51
+ console.log(`Ready as ${user.username}`);
52
+ });
53
+
54
+ client.on("messageCreate", message => {
55
+ console.log(message.content);
56
+ });
57
+
58
+ await client.login();
59
+ ```
60
+
61
+ Destroy the client when the application is shutting down:
62
+
63
+ ```ts
64
+ client.destroy();
65
+ ```
66
+
67
+ ## Client
68
+
69
+ `Client` is the main application entry point. It coordinates the REST transport, resource managers, Gateway, event dispatch, interactions, and lifecycle state.
70
+
71
+ ### Lifecycle
72
+
73
+ ```text
74
+ idle → connecting → ready
75
+ ↑ ↓
76
+ └──── reconnect ──┘
77
+
78
+ ready → destroyed
79
+ ```
80
+
81
+ Useful APIs include:
82
+
83
+ - `client.login()` — authenticate and connect to Discord.
84
+ - `client.isReady()` — type guard for a ready client.
85
+ - `client.destroy()` — close the Gateway and clear client-managed resources.
86
+ - `client.rest` — access the REST transport.
87
+ - `client.users`, `client.guilds`, `client.channels` — resource managers.
88
+
89
+ ## Gateway
90
+
91
+ The Gateway package implements the Discord WebSocket lifecycle:
92
+
93
+ ```text
94
+ CONNECT → HELLO → IDENTIFY/RESUME → READY → DISPATCH
95
+ ↘ HEARTBEAT / ACK
96
+ ↓
97
+ RECONNECT
98
+ ```
99
+
100
+ The Gateway tracks sequence numbers and sessions, handles Discord resume URLs, heartbeat acknowledgement timeouts, invalid sessions, server reconnect requests, and stale/zombie connections.
101
+
102
+ ```ts
103
+ import { Gateway } from "@lunibee/ws";
104
+
105
+ const gateway = new Gateway({
106
+ token: process.env.DISCORD_TOKEN!,
107
+ intents: 513
108
+ });
109
+
110
+ await gateway.connect();
111
+ ```
112
+
113
+ ## REST
114
+
115
+ The REST client supports Discord bucket-aware rate limiting and retries. It consumes Discord's rate-limit headers including bucket identifiers, remaining requests, reset information, and `Retry-After`.
116
+
117
+ Requests accept an `AbortSignal`:
118
+
119
+ ```ts
120
+ const controller = new AbortController();
121
+
122
+ const request = client.rest.get("/users/@me", {
123
+ signal: controller.signal
124
+ });
125
+
126
+ controller.abort();
127
+ await request;
128
+ ```
129
+
130
+ `RESTError` includes HTTP status, Discord error code, method, path, and the raw error payload when available.
131
+
132
+ ## Structures and caching
133
+
134
+ Resource managers maintain canonical instances by Discord resource ID. Re-resolving an already cached resource returns the same structure instance, allowing identity-sensitive application code to remain consistent.
135
+
136
+ REST-created and Gateway-updated resources are routed through manager cache mutation APIs so the same resource is not represented by unrelated structure instances.
137
+
138
+ ## Permissions
139
+
140
+ `PermissionsBitField` provides named and raw permission checks:
141
+
142
+ ```ts
143
+ if (member.permissions.has("ManageMessages")) {
144
+ // permitted
145
+ }
146
+ ```
147
+
148
+ Multiple permissions can be checked together, and immutable `add()` / `remove()` operations return a new bitfield.
149
+
150
+ ## Interactions
151
+
152
+ Interactions expose an ergonomic acknowledgement lifecycle:
153
+
154
+ ```ts
155
+ if (interaction.isChatInputCommand()) {
156
+ await interaction.deferReply();
157
+ await interaction.editReply({ content: "Done!" });
158
+ await interaction.followUp({ content: "Follow-up" });
159
+ }
160
+ ```
161
+
162
+ Available lifecycle methods include `reply()`, `deferReply()`, `editReply()`, `deleteReply()`, and `followUp()`.
163
+
164
+ ## Builders
165
+
166
+ Lunibee provides strict builders for Discord payloads, including:
167
+
168
+ - `EmbedBuilder`
169
+ - `ButtonBuilder`
170
+ - `ActionRowBuilder`
171
+ - `StringSelectBuilder`
172
+ - `EntitySelectBuilder`
173
+ - `ModalBuilder`
174
+ - `TextInputBuilder`
175
+
176
+ Builders validate Discord limits before serialization and expose typed `toJSON()` payloads.
177
+
178
+ ## Sharding
179
+
180
+ `@lunibee/sharding` manages multiple Gateway connections and supports explicit shard counts or Discord's recommended shard count.
181
+
182
+ ```ts
183
+ import { ShardManager } from "@lunibee/sharding";
184
+
185
+ const shards = new ShardManager({
186
+ token: process.env.DISCORD_TOKEN!,
187
+ intents: 513,
188
+ shardCount: "auto"
189
+ });
190
+
191
+ await shards.connect();
192
+ ```
193
+
194
+ Call `destroy()` during shutdown. The manager releases its Gateway instances and can initialize a fresh shard set on a later `connect()`.
195
+
196
+ ## Package layout
197
+
198
+ The monorepo is organized into focused packages:
199
+
200
+ | Package | Responsibility |
201
+ | --- | --- |
202
+ | `@lunibee/types` | Discord API and shared TypeScript types |
203
+ | `@lunibee/structures` | Discord resource and interaction structures |
204
+ | `@lunibee/managers` | Resource caches and REST-backed managers |
205
+ | `@lunibee/rest` | HTTP transport, routes, rate limits, retries |
206
+ | `@lunibee/ws` | Discord Gateway connection |
207
+ | `@lunibee/core` | Main client and high-level orchestration |
208
+ | `@lunibee/builders` | Typed Discord payload builders |
209
+ | `@lunibee/sharding` | Multi-Gateway shard management |
210
+ | `lunibee` | End-user package entry point |
211
+
212
+ ## Development
213
+
214
+ Run the repository's checks before submitting changes:
215
+
216
+ ```bash
217
+ bun install
218
+ bunx tsc --noEmit
219
+ ```
220
+
221
+ Keep production-readiness work on the active feature branch and commit each completed phase separately. Changes must not be made directly on `master`.
222
+
223
+ ## API reference
224
+
225
+ The source is the authoritative API surface while Lunibee remains pre-1.0. Public exports are intentionally split by responsibility so applications can import either the high-level `lunibee` package or individual packages when appropriate.
226
+
227
+ ## Status
228
+
229
+ Lunibee is in active development and the API may change before the first stable release.
@@ -0,0 +1,20 @@
1
+ export interface AttachmentData {
2
+ name: string;
3
+ description?: string;
4
+ file: Uint8Array | ArrayBuffer | Blob | Buffer | string;
5
+ }
6
+ /** Builder for message attachments and file uploads. */
7
+ export declare class AttachmentBuilder {
8
+ name: string;
9
+ description?: string;
10
+ file: Uint8Array | ArrayBuffer | Blob | Buffer | string;
11
+ constructor(file: Uint8Array | ArrayBuffer | Blob | Buffer | string, data?: Partial<Omit<AttachmentData, "file">> | string);
12
+ /** Sets the attachment filename. */
13
+ setName(name: string): this;
14
+ /** Sets the attachment description / alt text. */
15
+ setDescription(description: string): this;
16
+ /** Sets the file contents. */
17
+ setFile(file: Uint8Array | ArrayBuffer | Blob | Buffer | string): this;
18
+ /** Resolves the attachment payload to a binary Uint8Array. */
19
+ toBuffer(): Promise<Uint8Array>;
20
+ }
@@ -0,0 +1,118 @@
1
+ /** Discord application command option types. */
2
+ export declare const ApplicationCommandOptionType: {
3
+ readonly Subcommand: 1;
4
+ readonly SubcommandGroup: 2;
5
+ readonly String: 3;
6
+ readonly Integer: 4;
7
+ readonly Boolean: 5;
8
+ readonly User: 6;
9
+ readonly Channel: 7;
10
+ readonly Role: 8;
11
+ readonly Mentionable: 9;
12
+ readonly Number: 10;
13
+ readonly Attachment: 11;
14
+ };
15
+ /** Builds Discord application command payloads. */
16
+ export declare class SlashCommandBuilder {
17
+ #private;
18
+ /** Sets the command name. */ setName(name: string): this;
19
+ /** Sets the command description. */ setDescription(description: string): this;
20
+ /** Sets whether the command is available in direct messages. */ setDMPermission(enabled: boolean): this;
21
+ /** Sets whether the command is NSFW. */
22
+ setNSFW(nsfw?: boolean): this;
23
+ /** Sets whether the command is NSFW. */
24
+ setNsfw(nsfw?: boolean): this;
25
+ /** Sets command default member permissions. */ setDefaultMemberPermissions(permissions: bigint | number | string | null): this;
26
+ /** Sets command integration types. */ setIntegrationTypes(...types: number[]): this;
27
+ /** Adds a string option. */ addStringOption(configure: (option: StringOptionBuilder) => StringOptionBuilder): this;
28
+ /** Adds an integer option. */ addIntegerOption(configure: (option: IntegerOptionBuilder) => IntegerOptionBuilder): this;
29
+ /** Adds a number option. */ addNumberOption(configure: (option: NumberOptionBuilder) => NumberOptionBuilder): this;
30
+ /** Adds a boolean option. */ addBooleanOption(configure: (option: BooleanOptionBuilder) => BooleanOptionBuilder): this;
31
+ /** Adds a user option. */ addUserOption(configure: (option: UserOptionBuilder) => UserOptionBuilder): this;
32
+ /** Adds a channel option. */ addChannelOption(configure: (option: ChannelOptionBuilder) => ChannelOptionBuilder): this;
33
+ /** Adds a role option. */ addRoleOption(configure: (option: RoleOptionBuilder) => RoleOptionBuilder): this;
34
+ /** Adds a mentionable option. */ addMentionableOption(configure: (option: MentionableOptionBuilder) => MentionableOptionBuilder): this;
35
+ /** Adds an attachment option. */ addAttachmentOption(configure: (option: AttachmentOptionBuilder) => AttachmentOptionBuilder): this;
36
+ /** Adds a subcommand. */ addSubcommand(configure: (option: SubcommandBuilder) => SubcommandBuilder): this;
37
+ /** Adds a subcommand group. */ addSubcommandGroup(configure: (option: SubcommandGroupBuilder) => SubcommandGroupBuilder): this;
38
+ /** Serializes the command payload. */ toJSON(): Record<string, unknown>;
39
+ /** Adds a validated top-level command option. */ protected addOption(option: CommandOptionBuilder): this;
40
+ }
41
+ /** Base builder for command options. */
42
+ export declare class CommandOptionBuilder {
43
+ protected readonly data: Record<string, unknown>;
44
+ /** Creates an option builder. */ constructor(type: number);
45
+ /** Sets the option name. */ setName(name: string): this;
46
+ /** Sets the option description. */ setDescription(description: string): this;
47
+ /** Makes the option required or optional. */ setRequired(required?: boolean): this;
48
+ /** Sets autocomplete. */ setAutocomplete(enabled?: boolean): this;
49
+ /** Serializes the option payload. */ toJSON(): Record<string, unknown>;
50
+ }
51
+ /** Builds a string command option. */
52
+ export declare class StringOptionBuilder extends CommandOptionBuilder {
53
+ /** Creates a string option. */ constructor();
54
+ /** Adds string choices. */ addChoices(...choices: Array<{
55
+ name: string;
56
+ value: string;
57
+ }>): this;
58
+ /** Sets the minimum string length. */ setMinLength(value: number): this;
59
+ /** Sets the maximum string length. */ setMaxLength(value: number): this;
60
+ }
61
+ /** Builds an integer command option. */
62
+ export declare class IntegerOptionBuilder extends CommandOptionBuilder {
63
+ constructor();
64
+ setMinValue(value: number): this;
65
+ setMaxValue(value: number): this;
66
+ setAutocomplete(enabled?: boolean): this;
67
+ addChoices(...choices: {
68
+ name: string;
69
+ value: number;
70
+ }[]): this;
71
+ }
72
+ /** Builds a number command option. */
73
+ export declare class NumberOptionBuilder extends CommandOptionBuilder {
74
+ constructor();
75
+ setMinValue(value: number): this;
76
+ setMaxValue(value: number): this;
77
+ setAutocomplete(enabled?: boolean): this;
78
+ addChoices(...choices: {
79
+ name: string;
80
+ value: number;
81
+ }[]): this;
82
+ }
83
+ /** Builds a boolean command option. */ export declare class BooleanOptionBuilder extends CommandOptionBuilder {
84
+ /** Creates a boolean option. */ constructor();
85
+ }
86
+ /** Builds a user command option. */ export declare class UserOptionBuilder extends CommandOptionBuilder {
87
+ /** Creates a user option. */ constructor();
88
+ }
89
+ /** Builds a role command option. */ export declare class RoleOptionBuilder extends CommandOptionBuilder {
90
+ /** Creates a role option. */ constructor();
91
+ }
92
+ /** Builds a mentionable command option. */ export declare class MentionableOptionBuilder extends CommandOptionBuilder {
93
+ /** Creates a mentionable option. */ constructor();
94
+ }
95
+ /** Builds an attachment command option. */ export declare class AttachmentOptionBuilder extends CommandOptionBuilder {
96
+ /** Creates an attachment option. */ constructor();
97
+ }
98
+ /** Builds a channel command option. */ export declare class ChannelOptionBuilder extends CommandOptionBuilder {
99
+ /** Creates a channel option. */ constructor();
100
+ /** Restricts accepted channel types. */ addChannelTypes(...types: number[]): this;
101
+ }
102
+ /** Builds a nested subcommand. */ export declare class SubcommandBuilder extends CommandOptionBuilder {
103
+ /** Creates a subcommand. */ constructor();
104
+ /** Adds a string option to this subcommand. */ addStringOption(configure: (option: StringOptionBuilder) => StringOptionBuilder): this;
105
+ /** Adds an integer option to this subcommand. */ addIntegerOption(configure: (option: IntegerOptionBuilder) => IntegerOptionBuilder): this;
106
+ /** Adds a number option to this subcommand. */ addNumberOption(configure: (option: NumberOptionBuilder) => NumberOptionBuilder): this;
107
+ /** Adds a boolean option to this subcommand. */ addBooleanOption(configure: (option: BooleanOptionBuilder) => BooleanOptionBuilder): this;
108
+ /** Adds a user option to this subcommand. */ addUserOption(configure: (option: UserOptionBuilder) => UserOptionBuilder): this;
109
+ /** Adds a channel option to this subcommand. */ addChannelOption(configure: (option: ChannelOptionBuilder) => ChannelOptionBuilder): this;
110
+ /** Adds a role option to this subcommand. */ addRoleOption(configure: (option: RoleOptionBuilder) => RoleOptionBuilder): this;
111
+ /** Adds a mentionable option to this subcommand. */ addMentionableOption(configure: (option: MentionableOptionBuilder) => MentionableOptionBuilder): this;
112
+ /** Adds an attachment option to this subcommand. */ addAttachmentOption(configure: (option: AttachmentOptionBuilder) => AttachmentOptionBuilder): this;
113
+ protected addChildOption(option: CommandOptionBuilder): this;
114
+ }
115
+ /** Builds a nested subcommand group. */ export declare class SubcommandGroupBuilder extends CommandOptionBuilder {
116
+ /** Creates a subcommand group. */ constructor();
117
+ /** Adds a subcommand to this group. */ addSubcommand(configure: (option: SubcommandBuilder) => SubcommandBuilder): this;
118
+ }
@@ -0,0 +1,151 @@
1
+ /** Component type constants exposed by Lunibee. */
2
+ export declare const ComponentType: {
3
+ readonly ActionRow: 1;
4
+ readonly Button: 2;
5
+ readonly StringSelect: 3;
6
+ readonly TextInput: 4;
7
+ readonly UserSelect: 5;
8
+ readonly RoleSelect: 6;
9
+ readonly MentionableSelect: 7;
10
+ readonly ChannelSelect: 8;
11
+ };
12
+ export declare const ButtonStyle: {
13
+ readonly Primary: 1;
14
+ readonly Secondary: 2;
15
+ readonly Success: 3;
16
+ readonly Danger: 4;
17
+ readonly Link: 5;
18
+ };
19
+ export declare const TextInputStyle: {
20
+ readonly Short: 1;
21
+ readonly Paragraph: 2;
22
+ };
23
+ export interface APIComponentEmoji {
24
+ id?: string | null;
25
+ name?: string | null;
26
+ animated?: boolean;
27
+ }
28
+ export interface APIButtonComponent {
29
+ type: typeof ComponentType.Button;
30
+ style: 1 | 2 | 3 | 4 | 5;
31
+ custom_id?: string;
32
+ label?: string;
33
+ emoji?: APIComponentEmoji;
34
+ url?: string;
35
+ disabled?: boolean;
36
+ }
37
+ export interface APISelectOption {
38
+ label: string;
39
+ value: string;
40
+ description?: string;
41
+ emoji?: APIComponentEmoji;
42
+ default?: boolean;
43
+ }
44
+ export interface APIStringSelectComponent {
45
+ type: typeof ComponentType.StringSelect;
46
+ custom_id?: string;
47
+ placeholder?: string;
48
+ min_values?: number;
49
+ max_values?: number;
50
+ required?: boolean;
51
+ disabled?: boolean;
52
+ options?: APISelectOption[];
53
+ }
54
+ export interface APIEntitySelectComponent {
55
+ type: typeof ComponentType.UserSelect | typeof ComponentType.RoleSelect | typeof ComponentType.MentionableSelect | typeof ComponentType.ChannelSelect;
56
+ custom_id?: string;
57
+ placeholder?: string;
58
+ min_values?: number;
59
+ max_values?: number;
60
+ required?: boolean;
61
+ disabled?: boolean;
62
+ }
63
+ export interface APITextInputComponent {
64
+ type: typeof ComponentType.TextInput;
65
+ style: typeof TextInputStyle.Short | typeof TextInputStyle.Paragraph;
66
+ custom_id?: string;
67
+ label?: string;
68
+ placeholder?: string;
69
+ min_length?: number;
70
+ max_length?: number;
71
+ required?: boolean;
72
+ value?: string;
73
+ }
74
+ export interface APIModalComponent {
75
+ type: 9;
76
+ custom_id?: string;
77
+ title?: string;
78
+ components: APIActionRowComponent[];
79
+ }
80
+ export type APIActionRowChild = APIButtonComponent | APIStringSelectComponent | APIEntitySelectComponent | APITextInputComponent;
81
+ export interface APIActionRowComponent {
82
+ type: typeof ComponentType.ActionRow;
83
+ components: APIActionRowChild[];
84
+ }
85
+ export declare class ActionRowBuilder<T extends {
86
+ toJSON(): APIActionRowChild;
87
+ } = {
88
+ toJSON(): APIActionRowChild;
89
+ }> {
90
+ #private;
91
+ addComponents(...components: T[]): this;
92
+ clearComponents(): this;
93
+ toJSON(): APIActionRowComponent;
94
+ }
95
+ export declare class StringSelectBuilder {
96
+ #private;
97
+ setCustomId(value: string): this;
98
+ setPlaceholder(value: string): this;
99
+ setMinValues(value: number): this;
100
+ setMaxValues(value: number): this;
101
+ setRequired(value?: boolean): this;
102
+ setDisabled(value?: boolean): this;
103
+ addOptions(...options: APISelectOption[]): this;
104
+ toJSON(): APIStringSelectComponent;
105
+ }
106
+ export declare class ButtonBuilder {
107
+ #private;
108
+ setStyle(style: APIButtonComponent["style"]): this;
109
+ setCustomId(value: string): this;
110
+ setLabel(value: string): this;
111
+ setURL(value: string): this;
112
+ setEmoji(emoji: APIComponentEmoji | string): this;
113
+ setDisabled(value?: boolean): this;
114
+ toJSON(): APIButtonComponent;
115
+ }
116
+ export declare class EntitySelectBuilder {
117
+ #private;
118
+ constructor(type: typeof ComponentType.UserSelect | typeof ComponentType.RoleSelect | typeof ComponentType.MentionableSelect | typeof ComponentType.ChannelSelect);
119
+ setCustomId(value: string): this;
120
+ setPlaceholder(value: string): this;
121
+ setMinValues(value: number): this;
122
+ setMaxValues(value: number): this;
123
+ setRequired(value?: boolean): this;
124
+ setDisabled(value?: boolean): this;
125
+ setDefaultValues(...values: {
126
+ id: string;
127
+ type: "user" | "role" | "channel";
128
+ }[]): this;
129
+ toJSON(): APIEntitySelectComponent;
130
+ }
131
+ export declare class ModalBuilder {
132
+ #private;
133
+ setCustomId(value: string): this;
134
+ setTitle(value: string): this;
135
+ addComponents(...components: Array<{
136
+ toJSON(): APIActionRowComponent;
137
+ }>): this;
138
+ toJSON(): APIModalComponent;
139
+ }
140
+ export declare class TextInputBuilder {
141
+ #private;
142
+ setStyle(style: APITextInputComponent["style"]): this;
143
+ setCustomId(value: string): this;
144
+ setLabel(value: string): this;
145
+ setPlaceholder(value: string): this;
146
+ setMinLength(value: number): this;
147
+ setMaxLength(value: number): this;
148
+ setRequired(value?: boolean): this;
149
+ setValue(value: string): this;
150
+ toJSON(): APITextInputComponent;
151
+ }
@@ -0,0 +1,59 @@
1
+ /** Discord API embed field payload. */
2
+ export interface EmbedField {
3
+ /** Field name. */ name: string;
4
+ /** Field value. */ value: string;
5
+ /** Whether the field is displayed inline. */ inline?: boolean;
6
+ }
7
+ /** Discord API embed footer payload. */
8
+ export interface EmbedFooter {
9
+ /** Footer text. */ text: string;
10
+ /** Footer icon URL. */ icon_url?: string;
11
+ }
12
+ /** Discord API embed author payload. */
13
+ export interface EmbedAuthor {
14
+ /** Author display name. */ name: string;
15
+ /** Author URL. */ url?: string;
16
+ /** Author icon URL. */ icon_url?: string;
17
+ }
18
+ /** Strict Discord API embed payload. */
19
+ export interface APIEmbed {
20
+ /** Embed title. */ title?: string;
21
+ /** Embed description. */ description?: string;
22
+ /** Embed URL. */ url?: string;
23
+ /** Embed color. */ color?: number;
24
+ /** ISO-8601 timestamp. */ timestamp?: string;
25
+ /** Embed footer. */ footer?: EmbedFooter;
26
+ /** Embed author. */ author?: EmbedAuthor;
27
+ /** Thumbnail payload. */ thumbnail?: {
28
+ url: string;
29
+ };
30
+ /** Image payload. */ image?: {
31
+ url: string;
32
+ };
33
+ /** Embed fields. */ fields?: EmbedField[];
34
+ }
35
+ /** Builds compile-time-safe rich embed payloads for Discord API requests. */
36
+ export declare class EmbedBuilder {
37
+ #private;
38
+ /** Sets the embed title. @param value Title text. @returns This builder. @throws {RangeError} If title exceeds Discord's limit. */ setTitle(value: string): this;
39
+ /** Sets the embed description. @param value Description text. @returns This builder. @throws {RangeError} If description exceeds Discord's limit. */ setDescription(value: string): this;
40
+ /** Sets the embed URL. @param value Absolute URL. @returns This builder. @throws {TypeError} If URL is invalid. */ setURL(value: string): this;
41
+ /** Sets the embed color. @param value RGB integer. @returns This builder. @throws {RangeError} If color is outside 24-bit RGB range. */ setColor(value: number): this;
42
+ /** Sets the embed timestamp. @param value Date value. @returns This builder. @throws {RangeError} If date is invalid. */ setTimestamp(value?: Date): this;
43
+ /** Sets the embed footer. @param value Footer payload. @returns This builder. @throws {RangeError} If footer text exceeds Discord's limit. */ setFooter(value: EmbedFooter): this;
44
+ /** Sets the embed author. @param value Author payload. @returns This builder. @throws {RangeError} If author name exceeds Discord's limit. */ setAuthor(value: EmbedAuthor): this;
45
+ /** Sets the thumbnail URL. @param value Thumbnail URL or payload. @returns This builder. @throws {TypeError} If URL is invalid. */ setThumbnail(value: {
46
+ url: string;
47
+ } | string): this;
48
+ /** Sets the image URL. @param value Image URL or payload. @returns This builder. @throws {TypeError} If URL is invalid. */ setImage(value: {
49
+ url: string;
50
+ } | string): this;
51
+ /** Adds embed fields. @param fields Field payloads. @returns This builder. @throws {RangeError} If the 25-field limit is exceeded. */ addFields(...fields: EmbedField[]): this;
52
+ setFields(fields: EmbedField[]): this;
53
+ /** Replaces fields starting at an index. @param index Start index. @param deleteCount Number of fields to remove. @param fields Replacement fields. @returns This builder. @throws {RangeError} If arguments are invalid or the 25-field limit is exceeded. */ spliceFields(index: number, deleteCount: number, ...fields: EmbedField[]): this;
54
+ /** Removes all embed fields. @returns This builder. */ clearFields(): this;
55
+ /** Removes the embed title. @returns This builder. */ clearTitle(): this;
56
+ /** Removes the embed description. @returns This builder. */ clearDescription(): this;
57
+ /** Returns a deep-cloned Discord API payload. @returns Strict embed payload. */ get data(): APIEmbed;
58
+ toJSON(): APIEmbed;
59
+ }
@@ -0,0 +1,5 @@
1
+ export { EmbedBuilder } from "./embed.js";
2
+ export type { EmbedField } from "./embed.js";
3
+ export { ButtonBuilder, ButtonStyle, ComponentType, ActionRowBuilder, StringSelectBuilder, EntitySelectBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, } from "./components.js";
4
+ export { SlashCommandBuilder, StringOptionBuilder, IntegerOptionBuilder, NumberOptionBuilder, BooleanOptionBuilder, UserOptionBuilder, ChannelOptionBuilder, RoleOptionBuilder, MentionableOptionBuilder, AttachmentOptionBuilder, SubcommandBuilder, SubcommandGroupBuilder, ApplicationCommandOptionType, } from "./commands.js";
5
+ export { AttachmentBuilder, type AttachmentData } from "./attachment.js";