lunibee 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -24
- package/dist/builders/commands.d.ts +37 -0
- package/dist/builders/components.d.ts +127 -12
- package/dist/builders/embed.d.ts +3 -1
- package/dist/builders/index.d.ts +2 -2
- package/dist/builders/index.js +319 -16
- package/dist/builders/index.js.map +8 -7
- package/dist/collection/index.d.ts +36 -0
- package/dist/collection/index.js +110 -6
- package/dist/collection/index.js.map +4 -4
- package/dist/core/events.d.ts +69 -3
- package/dist/core/index.d.ts +158 -90
- package/dist/core/index.js +1543 -1169
- package/dist/core/index.js.map +24 -23
- package/dist/core/permissions.d.ts +112 -53
- package/dist/formatters/index.d.ts +43 -3
- package/dist/formatters/index.js +64 -1
- package/dist/formatters/index.js.map +3 -3
- package/dist/handlers/index.js.map +2 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3882 -1588
- package/dist/index.js.map +43 -35
- package/dist/managers/emoji.d.ts +38 -0
- package/dist/managers/guild.d.ts +141 -0
- package/dist/managers/index.d.ts +86 -75
- package/dist/managers/index.js +1084 -67
- package/dist/managers/index.js.map +21 -16
- package/dist/managers/message.d.ts +7 -12
- package/dist/managers/user.d.ts +20 -0
- package/dist/rest/index.d.ts +173 -1
- package/dist/rest/index.js +343 -47
- package/dist/rest/index.js.map +8 -6
- package/dist/rest/redis.d.ts +37 -0
- package/dist/rest/routes.d.ts +26 -1
- package/dist/rest/store.d.ts +38 -0
- package/dist/rest/webhook.d.ts +2 -2
- package/dist/sharding/cluster.d.ts +61 -0
- package/dist/sharding/index.d.ts +8 -0
- package/dist/sharding/index.js +289 -18
- package/dist/sharding/index.js.map +8 -7
- package/dist/structures/audit-log.d.ts +26 -0
- package/dist/structures/base.d.ts +131 -48
- package/dist/structures/embed.d.ts +65 -0
- package/dist/structures/index.d.ts +74 -26
- package/dist/structures/index.js +1528 -59
- package/dist/structures/index.js.map +14 -8
- package/dist/structures/interactions.d.ts +72 -17
- package/dist/structures/resources.d.ts +199 -7
- package/dist/types/index.d.ts +605 -84
- package/dist/types/index.js +71 -1
- package/dist/types/index.js.map +3 -3
- package/dist/utils/index.js.map +2 -2
- package/dist/voice/index.d.ts +88 -0
- package/dist/voice/index.js +204 -5
- package/dist/voice/index.js.map +3 -3
- package/dist/ws/index.d.ts +40 -1
- package/dist/ws/index.js +105 -18
- package/dist/ws/index.js.map +4 -4
- package/package.json +16 -16
- package/dist/structures/permissions.d.ts +0 -73
package/README.md
CHANGED
|
@@ -2,26 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/lunibee)
|
|
4
4
|
[](https://www.npmjs.com/package/lunibee)
|
|
5
|
+
[](https://discord.gg/SSADgyBpgw)
|
|
5
6
|
|
|
6
7
|
[](https://www.npmjs.com/package/lunibee)
|
|
7
8
|
|
|
8
9
|
A lightweight, Bun-first Discord API library for TypeScript.
|
|
9
10
|
|
|
10
|
-
## Production-readiness status
|
|
11
|
-
|
|
12
|
-
Lunibee's production-readiness work is being developed on `feat/production-readiness`. **Do not use `master` for active development.**
|
|
13
|
-
|
|
14
|
-
The roadmap covers:
|
|
15
|
-
|
|
16
|
-
- strict package dependency boundaries and installability
|
|
17
|
-
- Discord Gateway lifecycle, heartbeat ACK handling, resume/reconnect, and zombie detection
|
|
18
|
-
- canonical resource caching and shared REST/Gateway hydration
|
|
19
|
-
- bucket-aware REST rate limits, retries, timeouts, and `AbortSignal` cancellation
|
|
20
|
-
- typed permissions and ergonomic interaction APIs
|
|
21
|
-
- compile-time-safe component and embed builders
|
|
22
|
-
- graceful client and shard shutdown
|
|
23
|
-
- public API documentation
|
|
24
|
-
|
|
25
11
|
## Requirements
|
|
26
12
|
|
|
27
13
|
- [Bun](https://bun.sh/) for the supported runtime and package manager
|
|
@@ -42,6 +28,10 @@ For application usage, install the published `lunibee` package when a release is
|
|
|
42
28
|
bun add lunibee
|
|
43
29
|
```
|
|
44
30
|
|
|
31
|
+
## Documentation
|
|
32
|
+
|
|
33
|
+
Full documentation, practical guides, and API references are available at **[lunibee.js.org](https://lunibee.js.org)**.
|
|
34
|
+
|
|
45
35
|
## Getting started
|
|
46
36
|
|
|
47
37
|
```ts
|
|
@@ -142,10 +132,10 @@ REST-created and Gateway-updated resources are routed through manager cache muta
|
|
|
142
132
|
|
|
143
133
|
## Permissions
|
|
144
134
|
|
|
145
|
-
`
|
|
135
|
+
`PermissionSet` provides named and raw permission checks:
|
|
146
136
|
|
|
147
137
|
```ts
|
|
148
|
-
if (member.permissions.has(
|
|
138
|
+
if (member.permissions.has(Permission.manageMessages)) {
|
|
149
139
|
// permitted
|
|
150
140
|
}
|
|
151
141
|
```
|
|
@@ -168,13 +158,12 @@ Available lifecycle methods include `reply()`, `deferReply()`, `editReply()`, `d
|
|
|
168
158
|
|
|
169
159
|
## Builders
|
|
170
160
|
|
|
171
|
-
Lunibee provides strict builders for Discord payloads, including:
|
|
161
|
+
Lunibee provides strict builders for Discord payloads (Discord.js V2 compatible), including:
|
|
172
162
|
|
|
173
|
-
- `EmbedBuilder`
|
|
174
|
-
- `ButtonBuilder`
|
|
175
163
|
- `ActionRowBuilder`
|
|
164
|
+
- `ButtonBuilder`
|
|
176
165
|
- `StringSelectBuilder`
|
|
177
|
-
- `
|
|
166
|
+
- `EmbedBuilder`
|
|
178
167
|
- `ModalBuilder`
|
|
179
168
|
- `TextInputBuilder`
|
|
180
169
|
|
|
@@ -223,11 +212,11 @@ bun install
|
|
|
223
212
|
bunx tsc --noEmit
|
|
224
213
|
```
|
|
225
214
|
|
|
226
|
-
|
|
215
|
+
## Documentation & API Reference
|
|
227
216
|
|
|
228
|
-
|
|
217
|
+
The full, official API reference and practical guides are available at **[lunibee.js.org](https://lunibee.js.org)**.
|
|
229
218
|
|
|
230
|
-
The source
|
|
219
|
+
The source remains the authoritative API surface while Lunibee is 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.
|
|
231
220
|
|
|
232
221
|
## Status
|
|
233
222
|
|
|
@@ -116,3 +116,40 @@ export declare class NumberOptionBuilder extends CommandOptionBuilder {
|
|
|
116
116
|
/** Creates a subcommand group. */ constructor();
|
|
117
117
|
/** Adds a subcommand to this group. */ addSubcommand(configure: (option: SubcommandBuilder) => SubcommandBuilder): this;
|
|
118
118
|
}
|
|
119
|
+
/** Base builder for application commands that appear in right-click context menus. */
|
|
120
|
+
declare class ContextMenuCommandBuilder {
|
|
121
|
+
protected readonly data: Record<string, unknown>;
|
|
122
|
+
constructor(type: 2 | 3);
|
|
123
|
+
/** Sets the command name (shown in the right-click menu).
|
|
124
|
+
* Unlike CHAT_INPUT commands, USER (type 2) and MESSAGE (type 3) context-menu
|
|
125
|
+
* command names may contain uppercase letters and spaces, so no lowercase/charset
|
|
126
|
+
* validation is applied here — only Discord's 1-32 length limit and a non-empty
|
|
127
|
+
* (non-whitespace) requirement are enforced.
|
|
128
|
+
* @param name Display name; 1-32 characters, mixed case and spaces allowed.
|
|
129
|
+
* @throws {RangeError} If the name is empty/whitespace-only or exceeds 32 characters.
|
|
130
|
+
*/
|
|
131
|
+
setName(name: string): this;
|
|
132
|
+
/** Sets default member permissions required to see this command. */
|
|
133
|
+
setDefaultMemberPermissions(permissions: bigint | number | string | null): this;
|
|
134
|
+
/** Sets whether the command is available in direct messages. */
|
|
135
|
+
setDMPermission(enabled: boolean): this;
|
|
136
|
+
/** Sets command integration types. */
|
|
137
|
+
setIntegrationTypes(...types: number[]): this;
|
|
138
|
+
/** Serializes the command payload for the Discord API. */
|
|
139
|
+
toJSON(): Record<string, unknown>;
|
|
140
|
+
}
|
|
141
|
+
/** Builds a User context menu command (appears when right-clicking a user, type 2).
|
|
142
|
+
* @example
|
|
143
|
+
* new UserCommandBuilder().setName("View Profile").toJSON()
|
|
144
|
+
*/
|
|
145
|
+
export declare class UserCommandBuilder extends ContextMenuCommandBuilder {
|
|
146
|
+
constructor();
|
|
147
|
+
}
|
|
148
|
+
/** Builds a Message context menu command (appears when right-clicking a message, type 3).
|
|
149
|
+
* @example
|
|
150
|
+
* new MessageCommandBuilder().setName("Translate Message").toJSON()
|
|
151
|
+
*/
|
|
152
|
+
export declare class MessageCommandBuilder extends ContextMenuCommandBuilder {
|
|
153
|
+
constructor();
|
|
154
|
+
}
|
|
155
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ButtonStyle } from "@lunibee/types";
|
|
2
|
+
export { ButtonStyle };
|
|
1
3
|
/** Component type constants exposed by Lunibee. */
|
|
2
4
|
export declare const ComponentType: {
|
|
3
5
|
readonly ActionRow: 1;
|
|
@@ -8,13 +10,14 @@ export declare const ComponentType: {
|
|
|
8
10
|
readonly RoleSelect: 6;
|
|
9
11
|
readonly MentionableSelect: 7;
|
|
10
12
|
readonly ChannelSelect: 8;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
14
|
-
readonly
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
13
|
+
readonly Section: 9;
|
|
14
|
+
readonly TextDisplay: 10;
|
|
15
|
+
readonly Thumbnail: 11;
|
|
16
|
+
readonly MediaGallery: 12;
|
|
17
|
+
readonly File: 13;
|
|
18
|
+
readonly Separator: 14;
|
|
19
|
+
readonly ContentInventoryEntry: 16;
|
|
20
|
+
readonly Container: 17;
|
|
18
21
|
};
|
|
19
22
|
export declare const TextInputStyle: {
|
|
20
23
|
readonly Short: 1;
|
|
@@ -27,7 +30,7 @@ export interface APIComponentEmoji {
|
|
|
27
30
|
}
|
|
28
31
|
export interface APIButtonComponent {
|
|
29
32
|
type: typeof ComponentType.Button;
|
|
30
|
-
style: 1 | 2 | 3 | 4 | 5;
|
|
33
|
+
style: 1 | 2 | 3 | 4 | 5 | 6;
|
|
31
34
|
custom_id?: string;
|
|
32
35
|
label?: string;
|
|
33
36
|
emoji?: APIComponentEmoji;
|
|
@@ -59,6 +62,7 @@ export interface APIEntitySelectComponent {
|
|
|
59
62
|
max_values?: number;
|
|
60
63
|
required?: boolean;
|
|
61
64
|
disabled?: boolean;
|
|
65
|
+
default_values?: APISelectDefaultValue[];
|
|
62
66
|
}
|
|
63
67
|
export interface APITextInputComponent {
|
|
64
68
|
type: typeof ComponentType.TextInput;
|
|
@@ -82,6 +86,61 @@ export interface APIActionRowComponent {
|
|
|
82
86
|
type: typeof ComponentType.ActionRow;
|
|
83
87
|
components: APIActionRowChild[];
|
|
84
88
|
}
|
|
89
|
+
export interface APISectionComponent {
|
|
90
|
+
type: typeof ComponentType.Section;
|
|
91
|
+
components?: APIComponent[];
|
|
92
|
+
accessory?: APIComponent;
|
|
93
|
+
}
|
|
94
|
+
export interface APITextDisplayComponent {
|
|
95
|
+
type: typeof ComponentType.TextDisplay;
|
|
96
|
+
content: string;
|
|
97
|
+
}
|
|
98
|
+
export interface APIMediaGalleryComponent {
|
|
99
|
+
type: typeof ComponentType.MediaGallery;
|
|
100
|
+
items: {
|
|
101
|
+
media: {
|
|
102
|
+
url: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
};
|
|
105
|
+
}[];
|
|
106
|
+
}
|
|
107
|
+
/** Default values accepted by an auto-populated entity select. */
|
|
108
|
+
export interface APISelectDefaultValue {
|
|
109
|
+
id: string;
|
|
110
|
+
type: "user" | "role" | "channel";
|
|
111
|
+
}
|
|
112
|
+
export interface APIFileComponent {
|
|
113
|
+
type: typeof ComponentType.File;
|
|
114
|
+
file: {
|
|
115
|
+
url: string;
|
|
116
|
+
};
|
|
117
|
+
spoiler?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface APISeparatorComponent {
|
|
120
|
+
type: typeof ComponentType.Separator;
|
|
121
|
+
spacing?: 1 | 2;
|
|
122
|
+
divider?: boolean;
|
|
123
|
+
}
|
|
124
|
+
export interface APIThumbnailComponent {
|
|
125
|
+
type: typeof ComponentType.Thumbnail;
|
|
126
|
+
url: string;
|
|
127
|
+
proxy_url?: string;
|
|
128
|
+
width?: number;
|
|
129
|
+
height?: number;
|
|
130
|
+
description?: string;
|
|
131
|
+
spoiler?: boolean;
|
|
132
|
+
}
|
|
133
|
+
export interface APIContentInventoryEntryComponent {
|
|
134
|
+
type: typeof ComponentType.ContentInventoryEntry;
|
|
135
|
+
id: string;
|
|
136
|
+
}
|
|
137
|
+
export interface APIContainerComponent {
|
|
138
|
+
type: typeof ComponentType.Container;
|
|
139
|
+
components: APIComponent[];
|
|
140
|
+
accent_color?: number;
|
|
141
|
+
spoiler?: boolean;
|
|
142
|
+
}
|
|
143
|
+
export type APIComponent = APIActionRowComponent | APIButtonComponent | APIStringSelectComponent | APIEntitySelectComponent | APITextInputComponent | APISectionComponent | APITextDisplayComponent | APIThumbnailComponent | APIMediaGalleryComponent | APIFileComponent | APISeparatorComponent | APIContentInventoryEntryComponent | APIContainerComponent;
|
|
85
144
|
export declare class ActionRowBuilder<T extends {
|
|
86
145
|
toJSON(): APIActionRowChild;
|
|
87
146
|
} = {
|
|
@@ -122,10 +181,7 @@ export declare class EntitySelectBuilder {
|
|
|
122
181
|
setMaxValues(value: number): this;
|
|
123
182
|
setRequired(value?: boolean): this;
|
|
124
183
|
setDisabled(value?: boolean): this;
|
|
125
|
-
setDefaultValues(...values:
|
|
126
|
-
id: string;
|
|
127
|
-
type: "user" | "role" | "channel";
|
|
128
|
-
}[]): this;
|
|
184
|
+
setDefaultValues(...values: APISelectDefaultValue[]): this;
|
|
129
185
|
toJSON(): APIEntitySelectComponent;
|
|
130
186
|
}
|
|
131
187
|
export declare class ModalBuilder {
|
|
@@ -149,3 +205,62 @@ export declare class TextInputBuilder {
|
|
|
149
205
|
setValue(value: string): this;
|
|
150
206
|
toJSON(): APITextInputComponent;
|
|
151
207
|
}
|
|
208
|
+
export declare class ContainerBuilder {
|
|
209
|
+
#private;
|
|
210
|
+
addComponents(...components: {
|
|
211
|
+
toJSON(): APIComponent;
|
|
212
|
+
}[]): this;
|
|
213
|
+
setAccentColor(color: number): this;
|
|
214
|
+
/** Marks the whole container as a spoiler (blurred until clicked). */
|
|
215
|
+
setSpoiler(spoiler?: boolean): this;
|
|
216
|
+
toJSON(): APIContainerComponent;
|
|
217
|
+
}
|
|
218
|
+
export declare class SectionBuilder {
|
|
219
|
+
#private;
|
|
220
|
+
addComponents(...components: {
|
|
221
|
+
toJSON(): APIComponent;
|
|
222
|
+
}[]): this;
|
|
223
|
+
setAccessory(accessory: {
|
|
224
|
+
toJSON(): APIComponent;
|
|
225
|
+
}): this;
|
|
226
|
+
toJSON(): APISectionComponent;
|
|
227
|
+
}
|
|
228
|
+
export declare class TextDisplayBuilder {
|
|
229
|
+
#private;
|
|
230
|
+
setContent(content: string): this;
|
|
231
|
+
toJSON(): APITextDisplayComponent;
|
|
232
|
+
}
|
|
233
|
+
export declare class MediaGalleryBuilder {
|
|
234
|
+
#private;
|
|
235
|
+
addItems(...items: {
|
|
236
|
+
url: string;
|
|
237
|
+
description?: string;
|
|
238
|
+
}[]): this;
|
|
239
|
+
toJSON(): APIMediaGalleryComponent;
|
|
240
|
+
}
|
|
241
|
+
export declare class FileComponentBuilder {
|
|
242
|
+
#private;
|
|
243
|
+
setUrl(url: string): this;
|
|
244
|
+
setSpoiler(spoiler?: boolean): this;
|
|
245
|
+
toJSON(): APIFileComponent;
|
|
246
|
+
}
|
|
247
|
+
export declare class SeparatorBuilder {
|
|
248
|
+
#private;
|
|
249
|
+
setSpacing(spacing: 1 | 2): this;
|
|
250
|
+
setDivider(divider?: boolean): this;
|
|
251
|
+
toJSON(): APISeparatorComponent;
|
|
252
|
+
}
|
|
253
|
+
export declare class ThumbnailBuilder {
|
|
254
|
+
#private;
|
|
255
|
+
setUrl(url: string): this;
|
|
256
|
+
/** Sets the thumbnail's alt-text description. */
|
|
257
|
+
setDescription(description: string): this;
|
|
258
|
+
/** Marks the thumbnail as a spoiler (blurred until clicked). */
|
|
259
|
+
setSpoiler(spoiler?: boolean): this;
|
|
260
|
+
toJSON(): APIThumbnailComponent;
|
|
261
|
+
}
|
|
262
|
+
export declare class ContentInventoryEntryBuilder {
|
|
263
|
+
#private;
|
|
264
|
+
setId(id: string): this;
|
|
265
|
+
toJSON(): APIContentInventoryEntryComponent;
|
|
266
|
+
}
|
package/dist/builders/embed.d.ts
CHANGED
|
@@ -48,7 +48,9 @@ export declare class EmbedBuilder {
|
|
|
48
48
|
/** Sets the image URL. @param value Image URL or payload. @returns This builder. @throws {TypeError} If URL is invalid. */ setImage(value: {
|
|
49
49
|
url: string;
|
|
50
50
|
} | string): this;
|
|
51
|
-
/** Adds embed fields.
|
|
51
|
+
/** Adds embed fields. Accepts both the spread form `addFields(a, b)` and the
|
|
52
|
+
* single-array form `addFields([a, b])` for discord.js `RestOrArray` parity.
|
|
53
|
+
* @param fields Field payloads, spread or as a single array. @returns This builder. @throws {RangeError} If the 25-field limit is exceeded. */ addFields(...fields: EmbedField[] | [EmbedField[]]): this;
|
|
52
54
|
setFields(fields: EmbedField[]): this;
|
|
53
55
|
/** 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
56
|
/** Removes all embed fields. @returns This builder. */ clearFields(): this;
|
package/dist/builders/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EmbedBuilder } from "./embed.js";
|
|
2
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";
|
|
3
|
+
export { ButtonBuilder, ButtonStyle, ComponentType, ActionRowBuilder, StringSelectBuilder, EntitySelectBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ContainerBuilder, SectionBuilder, TextDisplayBuilder, MediaGalleryBuilder, FileComponentBuilder, SeparatorBuilder, ThumbnailBuilder, ContentInventoryEntryBuilder, } from "./components.js";
|
|
4
|
+
export { SlashCommandBuilder, StringOptionBuilder, IntegerOptionBuilder, NumberOptionBuilder, BooleanOptionBuilder, UserOptionBuilder, ChannelOptionBuilder, RoleOptionBuilder, MentionableOptionBuilder, AttachmentOptionBuilder, SubcommandBuilder, SubcommandGroupBuilder, ApplicationCommandOptionType, UserCommandBuilder, MessageCommandBuilder, } from "./commands.js";
|
|
5
5
|
export { AttachmentBuilder, type AttachmentData } from "./attachment.js";
|