lunibee 0.1.4 → 0.1.6

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 (42) hide show
  1. package/README.md +12 -23
  2. package/dist/builders/components.d.ts +108 -0
  3. package/dist/builders/index.d.ts +1 -1
  4. package/dist/builders/index.js +178 -2
  5. package/dist/builders/index.js.map +3 -3
  6. package/dist/collection/index.d.ts +6 -0
  7. package/dist/collection/index.js +33 -2
  8. package/dist/collection/index.js.map +4 -4
  9. package/dist/core/events.d.ts +67 -3
  10. package/dist/core/index.d.ts +120 -90
  11. package/dist/core/index.js +816 -1021
  12. package/dist/core/index.js.map +20 -21
  13. package/dist/formatters/index.js.map +1 -1
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.js +2215 -1392
  16. package/dist/index.js.map +29 -26
  17. package/dist/managers/guild.d.ts +30 -0
  18. package/dist/managers/index.d.ts +56 -75
  19. package/dist/managers/index.js +339 -48
  20. package/dist/managers/index.js.map +16 -12
  21. package/dist/managers/message.d.ts +7 -12
  22. package/dist/managers/user.d.ts +20 -0
  23. package/dist/rest/index.d.ts +83 -1
  24. package/dist/rest/index.js +48 -8
  25. package/dist/rest/index.js.map +4 -4
  26. package/dist/rest/routes.d.ts +4 -1
  27. package/dist/sharding/index.js +4 -1
  28. package/dist/sharding/index.js.map +4 -4
  29. package/dist/structures/base.d.ts +99 -48
  30. package/dist/structures/embed.d.ts +65 -0
  31. package/dist/structures/index.d.ts +45 -25
  32. package/dist/structures/index.js +569 -36
  33. package/dist/structures/index.js.map +10 -8
  34. package/dist/structures/interactions.d.ts +72 -17
  35. package/dist/structures/resources.d.ts +9 -5
  36. package/dist/types/index.d.ts +530 -85
  37. package/dist/types/index.js +71 -1
  38. package/dist/types/index.js.map +3 -3
  39. package/dist/voice/index.js.map +1 -1
  40. package/dist/ws/index.js +4 -1
  41. package/dist/ws/index.js.map +4 -4
  42. package/package.json +15 -15
@@ -6,16 +6,7 @@ export declare const InteractionType: {
6
6
  readonly ApplicationCommandAutocomplete: 4;
7
7
  readonly ModalSubmit: 5;
8
8
  };
9
- /** Discord interaction response type constants. */
10
- export declare const InteractionResponseType: {
11
- readonly Pong: 1;
12
- readonly ChannelMessage: 4;
13
- readonly DeferredChannelMessage: 5;
14
- readonly DeferredMessageUpdate: 6;
15
- readonly MessageUpdate: 7;
16
- readonly Autocomplete: 8;
17
- readonly Modal: 9;
18
- };
9
+ export { InteractionResponseType } from "@lunibee/types";
19
10
  /** Data shared by Discord interactions. */
20
11
  export interface InteractionData {
21
12
  /** Interaction identifier. */ id: string;
@@ -44,6 +35,58 @@ export interface InteractionClient {
44
35
  /** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */ deleteInteractionReply(token: string): Promise<void>;
45
36
  /** 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>;
46
37
  }
38
+ /** Raw Discord application command interaction data option. */
39
+ export interface APIInteractionDataOption {
40
+ name: string;
41
+ type: number;
42
+ value?: string | number | boolean;
43
+ options?: APIInteractionDataOption[];
44
+ focused?: boolean;
45
+ }
46
+ /**
47
+ * Typed resolver for application command options.
48
+ * Attached as `CommandInteraction.options`.
49
+ */
50
+ export declare class CommandOptions {
51
+ #private;
52
+ /** @internal */
53
+ constructor(options: APIInteractionDataOption[], resolved?: Record<string, unknown>);
54
+ /** Returns the invoked subcommand name, or null if none. */
55
+ getSubcommand(required?: false): string | null;
56
+ getSubcommand(required: true): string;
57
+ /** Returns the invoked subcommand group name, or null if none. */
58
+ getSubcommandGroup(required?: false): string | null;
59
+ getSubcommandGroup(required: true): string;
60
+ /** Gets a string option. @param name Option name. @param required If true, throws when missing. */
61
+ getString(name: string, required?: false): string | null;
62
+ getString(name: string, required: true): string;
63
+ /** Gets an integer option. @param name Option name. @param required If true, throws when missing. */
64
+ getInteger(name: string, required?: false): number | null;
65
+ getInteger(name: string, required: true): number;
66
+ /** Gets a number (float) option. @param name Option name. @param required If true, throws when missing. */
67
+ getNumber(name: string, required?: false): number | null;
68
+ getNumber(name: string, required: true): number;
69
+ /** Gets a boolean option. @param name Option name. @param required If true, throws when missing. */
70
+ getBoolean(name: string, required?: false): boolean | null;
71
+ getBoolean(name: string, required: true): boolean;
72
+ /** Gets the raw resolved user data for a user option. @param name Option name. @param required If true, throws when missing. */
73
+ getUser(name: string, required?: false): Record<string, unknown> | null;
74
+ getUser(name: string, required: true): Record<string, unknown>;
75
+ /** Gets the raw resolved channel data for a channel option. @param name Option name. @param required If true, throws when missing. */
76
+ getChannel(name: string, required?: false): Record<string, unknown> | null;
77
+ getChannel(name: string, required: true): Record<string, unknown>;
78
+ /** Gets the raw resolved role data for a role option. @param name Option name. @param required If true, throws when missing. */
79
+ getRole(name: string, required?: false): Record<string, unknown> | null;
80
+ getRole(name: string, required: true): Record<string, unknown>;
81
+ /** Gets the raw resolved user or role data for a mentionable option. @param name Option name. @param required If true, throws when missing. */
82
+ getMentionable(name: string, required?: false): Record<string, unknown> | null;
83
+ getMentionable(name: string, required: true): Record<string, unknown>;
84
+ /** Gets the raw resolved attachment data for an attachment option. @param name Option name. @param required If true, throws when missing. */
85
+ getAttachment(name: string, required?: false): Record<string, unknown> | null;
86
+ getAttachment(name: string, required: true): Record<string, unknown>;
87
+ /** Returns the raw option list for advanced use cases. */
88
+ get raw(): readonly APIInteractionDataOption[];
89
+ }
47
90
  /** A Discord interaction callback payload. */
48
91
  export declare class InteractionResponse {
49
92
  readonly type: number;
@@ -73,8 +116,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
73
116
  /** 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);
74
117
  /** Whether this interaction is an application command. @returns True for application command interactions. */ isChatInputCommand(): this is CommandInteraction;
75
118
  /** Whether this interaction is a message component. @returns True for component interactions. */ isMessageComponent(): this is ComponentInteraction;
76
- /** Whether this interaction is a modal submission. @returns True for modal submissions. */ isModalSubmit(): this is ComponentInteraction;
77
- /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */ isAutocomplete(): this is CommandInteraction;
119
+ /** Whether this interaction is a modal submission. @returns True for modal submissions. */ isModalSubmit(): this is ModalSubmitInteraction;
120
+ /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */ isAutocomplete(): this is AutocompleteInteraction;
78
121
  /** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */ protected assertUnacknowledged(): void;
79
122
  /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
80
123
  /** Posts a raw interaction response callback. */
@@ -93,9 +136,12 @@ export declare class Interaction<TData extends InteractionData = InteractionData
93
136
  [key: string]: unknown;
94
137
  }): Promise<unknown>;
95
138
  }
96
- /** Application command interaction. */
139
+ /** Application command interaction with fully typed option resolver. */
97
140
  export declare class CommandInteraction extends Interaction {
141
+ /** Typed option resolver. Access slash command options with full type safety. */
142
+ readonly options: CommandOptions;
98
143
  /** Invoked command name. @returns Command name or an empty string. */ get commandName(): string;
144
+ constructor(client: InteractionClient, data: InteractionData);
99
145
  }
100
146
  /** Message component interaction. */
101
147
  export declare class ComponentInteraction extends Interaction {
@@ -110,14 +156,14 @@ export declare class ComponentInteraction extends Interaction {
110
156
  /** Updates the message to which the component was attached. */
111
157
  update(options: InteractionReplyOptions | string): Promise<unknown>;
112
158
  }
113
- /** Creates a specialized interaction structure for a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @returns Specialized interaction structure. @throws {TypeError} If required identifiers are missing. */
114
- export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
115
159
  /** Represents a Discord modal submission interaction. */
116
160
  export declare class ModalSubmitInteraction extends Interaction {
117
161
  /** Gets the submitted modal custom ID. */
118
162
  get customId(): string;
119
- /** Retrieves the text value for a specific text input custom ID. */
163
+ /** Retrieves the text value for a specific text input custom ID. @param customId The custom_id of the text input component. @returns The submitted text, or undefined if not found. */
120
164
  getInputValue(customId: string): string | undefined;
165
+ /** Retrieves the text value for a text input, throwing if missing. @param customId The custom_id of the text input component. @returns The submitted text. @throws {TypeError} If the field is not found. */
166
+ getRequiredInputValue(customId: string): string;
121
167
  }
122
168
  /** Represents a Discord slash command autocomplete interaction. */
123
169
  export declare class AutocompleteInteraction extends Interaction {
@@ -127,10 +173,19 @@ export declare class AutocompleteInteraction extends Interaction {
127
173
  get focusedOption(): {
128
174
  name: string;
129
175
  value: unknown;
176
+ type: number;
130
177
  } | undefined;
131
- /** Responds to Discord with autocomplete choices. */
178
+ /** Responds to Discord with autocomplete choices. @param choices Array of name/value pairs to show. @throws {TypeError} If choices is not an array. */
132
179
  respond(choices: {
133
180
  name: string;
134
181
  value: string | number;
135
182
  }[]): Promise<void>;
136
183
  }
184
+ /**
185
+ * Creates a specialized interaction structure for a Gateway payload.
186
+ * @param client Interaction transport.
187
+ * @param data Gateway interaction payload.
188
+ * @returns Specialized interaction structure.
189
+ * @throws {TypeError} If required identifiers are missing.
190
+ */
191
+ export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
@@ -27,7 +27,10 @@ export declare class GuildMember {
27
27
  joined_at?: string;
28
28
  permissions?: string;
29
29
  });
30
- /** Effective member display name. @returns Nickname or user display name. */ get displayName(): string;
30
+ /** Effective member display name. @returns Nickname or user display name. */
31
+ get displayName(): string;
32
+ /** Returns the Discord user mention for this member. */
33
+ toString(): string;
31
34
  }
32
35
  /** A Discord guild role. */
33
36
  export declare class Role extends BaseStructure {
@@ -47,11 +50,11 @@ export declare class Role extends BaseStructure {
47
50
  managed?: boolean;
48
51
  mentionable?: boolean;
49
52
  });
50
- /** Discord role mention string. @returns Role mention. */ toString(): string;
53
+ /** Discord role mention string. Used automatically in template literals. */
54
+ toString(): string;
51
55
  }
52
56
  /** A Discord text-capable channel. */
53
57
  export declare class TextChannel extends Channel {
54
- /** Parent category ID. */ parentId?: string | null;
55
58
  /** Creates a text channel from Discord data. @param data Discord channel payload. */
56
59
  constructor(data: {
57
60
  id: string;
@@ -59,6 +62,7 @@ export declare class TextChannel extends Channel {
59
62
  name?: string;
60
63
  parent_id?: string | null;
61
64
  guild_id?: string;
62
- });
63
- /** Discord channel mention string. @returns Channel mention. */ toString(): string;
65
+ }, context?: import("./base.js").ResourceContext);
66
+ /** Discord channel mention string. Used automatically in template literals. */
67
+ toString(): string;
64
68
  }