lunibee 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +225 -225
  3. package/dist/builders/attachment.d.ts +10 -2
  4. package/dist/builders/commands.d.ts +161 -101
  5. package/dist/builders/components.d.ts +54 -75
  6. package/dist/builders/embed.d.ts +68 -35
  7. package/dist/builders/index.d.ts +1 -1
  8. package/dist/builders/index.js +108 -133
  9. package/dist/builders/index.js.map +8 -8
  10. package/dist/collection/cache.d.ts +13 -6
  11. package/dist/collection/index.d.ts +90 -17
  12. package/dist/collection/index.js +442 -266
  13. package/dist/collection/index.js.map +4 -4
  14. package/dist/core/index.d.ts +9 -0
  15. package/dist/core/index.js +791 -436
  16. package/dist/core/index.js.map +47 -47
  17. package/dist/core/permissions.d.ts +9 -5
  18. package/dist/formatters/index.js +9 -5
  19. package/dist/formatters/index.js.map +3 -3
  20. package/dist/handlers/index.js +5 -10
  21. package/dist/handlers/index.js.map +3 -3
  22. package/dist/index.js +1010 -679
  23. package/dist/index.js.map +66 -65
  24. package/dist/managers/base.d.ts +26 -14
  25. package/dist/managers/emoji.d.ts +7 -1
  26. package/dist/managers/guild-resources.d.ts +11 -3
  27. package/dist/managers/guild.d.ts +13 -5
  28. package/dist/managers/index.d.ts +28 -14
  29. package/dist/managers/index.js +580 -340
  30. package/dist/managers/index.js.map +26 -26
  31. package/dist/managers/member.d.ts +5 -3
  32. package/dist/managers/message.d.ts +7 -3
  33. package/dist/managers/role.d.ts +13 -1
  34. package/dist/rest/error-codes.d.ts +48 -0
  35. package/dist/rest/errors.d.ts +14 -6
  36. package/dist/rest/index.d.ts +25 -12
  37. package/dist/rest/index.js +105 -18
  38. package/dist/rest/index.js.map +15 -14
  39. package/dist/rest/redis.d.ts +1 -1
  40. package/dist/rest/route.d.ts +8 -4
  41. package/dist/rest/routes.d.ts +102 -46
  42. package/dist/rest/transport.d.ts +10 -5
  43. package/dist/rest/webhook.d.ts +9 -5
  44. package/dist/sharding/bus.d.ts +34 -17
  45. package/dist/sharding/index.d.ts +34 -17
  46. package/dist/sharding/index.js +68 -36
  47. package/dist/sharding/index.js.map +17 -17
  48. package/dist/structures/base.d.ts +28 -10
  49. package/dist/structures/channels.d.ts +28 -14
  50. package/dist/structures/index.d.ts +6 -6
  51. package/dist/structures/index.js +81 -99
  52. package/dist/structures/index.js.map +19 -18
  53. package/dist/structures/interactions.d.ts +98 -50
  54. package/dist/structures/resources.d.ts +90 -46
  55. package/dist/types/gateway.d.ts +1 -1
  56. package/dist/types/index.d.ts +43 -18
  57. package/dist/types/index.js +20 -22
  58. package/dist/types/index.js.map +4 -4
  59. package/dist/utils/index.js.map +2 -2
  60. package/dist/voice/index.d.ts +12 -4
  61. package/dist/voice/index.js +17 -20
  62. package/dist/voice/index.js.map +3 -3
  63. package/dist/ws/decoder.d.ts +6 -2
  64. package/dist/ws/index.d.ts +25 -13
  65. package/dist/ws/index.js +63 -31
  66. package/dist/ws/index.js.map +14 -14
  67. package/dist/ws/protocol.d.ts +10 -2
  68. package/dist/ws/session.d.ts +14 -4
  69. package/dist/ws/state.d.ts +22 -11
  70. package/package.json +16 -15
@@ -14,32 +14,50 @@ export type InteractionEnum = (typeof InteractionEnum)[keyof typeof InteractionE
14
14
  export { InteractionResponseEnum, InteractionResponseType, } from "@lunibee/types";
15
15
  /** Data shared by Discord interactions. */
16
16
  export interface InteractionData {
17
- /** Interaction identifier. */ id: string;
18
- /** Application identifier. */ application_id: string;
19
- /** Interaction type. */ type: number;
20
- /** Interaction token. */ token: string;
21
- /** Gateway/API version. */ version?: number;
22
- /** Guild identifier. */ guild_id?: string;
23
- /** Channel identifier. */ channel_id?: string;
24
- /** Interaction-specific data. */ data?: Record<string, unknown>;
17
+ /** Interaction identifier. */
18
+ id: string;
19
+ /** Application identifier. */
20
+ application_id: string;
21
+ /** Interaction type. */
22
+ type: number;
23
+ /** Interaction token. */
24
+ token: string;
25
+ /** Gateway/API version. */
26
+ version?: number;
27
+ /** Guild identifier. */
28
+ guild_id?: string;
29
+ /** Channel identifier. */
30
+ channel_id?: string;
31
+ /** Interaction-specific data. */
32
+ data?: Record<string, unknown>;
25
33
  [key: string]: unknown;
26
34
  }
27
35
  /** Options for an interaction response message. */
28
36
  export interface InteractionReplyOptions {
29
- /** Message content. */ content?: string;
30
- /** Whether the response is ephemeral. */ ephemeral?: boolean;
31
- /** Message components. */ components?: unknown[];
32
- /** Message embeds. */ embeds?: unknown[];
33
- /** Discord message flags. */ flags?: number;
34
- /** On `reply()` / `update()`: return the created message (one request, no `fetchReply()`). */ withResponse?: boolean;
37
+ /** Message content. */
38
+ content?: string;
39
+ /** Whether the response is ephemeral. */
40
+ ephemeral?: boolean;
41
+ /** Message components. */
42
+ components?: unknown[];
43
+ /** Message embeds. */
44
+ embeds?: unknown[];
45
+ /** Discord message flags. */
46
+ flags?: number;
47
+ /** On `reply()` / `update()`: return the created message (one request, no `fetchReply()`). */
48
+ withResponse?: boolean;
35
49
  [key: string]: unknown;
36
50
  }
37
51
  /** Transport required by an interaction structure. */
38
52
  export interface InteractionClient {
39
- /** Sends the initial interaction callback. @param id Interaction identifier. @param token Interaction token. @param response Callback payload. @returns Discord response. @throws {Error} When REST fails. */ postInteractionResponse(id: string, token: string, response: InteractionResponse): Promise<unknown>;
40
- /** 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>;
41
- /** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */ deleteInteractionReply(token: string): Promise<void>;
42
- /** 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>;
53
+ /** Sends the initial interaction callback. @param id Interaction identifier. @param token Interaction token. @param response Callback payload. @returns Discord response. @throws {Error} When REST fails. */
54
+ postInteractionResponse(id: string, token: string, response: InteractionResponse): Promise<unknown>;
55
+ /** Edits the original interaction response. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
56
+ editInteractionReply(token: string, data: InteractionReplyOptions): Promise<unknown>;
57
+ /** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */
58
+ deleteInteractionReply(token: string): Promise<void>;
59
+ /** Sends a follow-up interaction webhook message. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
60
+ followUpInteraction(token: string, data: InteractionReplyOptions): Promise<unknown>;
43
61
  /** 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}. */
44
62
  interactionWebhookMessage?(method: "GET" | "PATCH" | "DELETE", applicationId: string, token: string, messageId: string, data?: InteractionReplyOptions): Promise<unknown>;
45
63
  /** Lets structures built from an interaction (such as {@link Interaction.member}) act through the client. Optional. */
@@ -55,27 +73,41 @@ export declare class InteractionResponse {
55
73
  withResponse: boolean;
56
74
  /** Creates a response payload. @param type Discord callback type. @param data Optional callback data. @throws {TypeError} If type is not finite. */
57
75
  constructor(type: number, data?: InteractionReplyOptions);
58
- /** Serializes the response for Discord. @returns Discord callback payload. */ toJSON(): {
76
+ /** Serializes the response for Discord. @returns Discord callback payload. */
77
+ toJSON(): {
59
78
  type: number;
60
79
  data?: InteractionReplyOptions;
61
80
  };
62
- /** Creates an immediate message response. @param options Response message options. @returns Callback payload. */ static message(options: InteractionReplyOptions): InteractionResponse;
63
- /** Creates a deferred channel response. @param ephemeral Whether the eventual response is ephemeral. @returns Callback payload. */ static defer(ephemeral?: boolean): InteractionResponse;
64
- /** Creates a Pong response. @returns Callback payload. */ static pong(): InteractionResponse;
81
+ /** Creates an immediate message response. @param options Response message options. @returns Callback payload. */
82
+ static message(options: InteractionReplyOptions): InteractionResponse;
83
+ /** Creates a deferred channel response. @param ephemeral Whether the eventual response is ephemeral. @returns Callback payload. */
84
+ static defer(ephemeral?: boolean): InteractionResponse;
85
+ /** Creates a Pong response. @returns Callback payload. */
86
+ static pong(): InteractionResponse;
65
87
  }
66
88
  /** Base interaction structure. */
67
89
  export declare class Interaction<TData extends InteractionData = InteractionData> {
68
90
  #private;
69
- /** Interaction identifier. */ readonly id: string;
70
- /** Application identifier. */ readonly applicationId: string;
71
- /** Interaction token. */ readonly token: string;
72
- /** Guild identifier. */ readonly guildId?: string;
73
- /** Channel identifier. */ readonly channelId?: string;
74
- /** Interaction type. */ readonly type: number;
75
- /** Raw interaction data. */ readonly data: TData;
76
- /** Whether the initial response was sent. */ replied: boolean;
77
- /** Whether the initial response was deferred. */ deferred: boolean;
78
- /** 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);
91
+ /** Interaction identifier. */
92
+ readonly id: string;
93
+ /** Application identifier. */
94
+ readonly applicationId: string;
95
+ /** Interaction token. */
96
+ readonly token: string;
97
+ /** Guild identifier. */
98
+ readonly guildId?: string;
99
+ /** Channel identifier. */
100
+ readonly channelId?: string;
101
+ /** Interaction type. */
102
+ readonly type: number;
103
+ /** Raw interaction data. */
104
+ readonly data: TData;
105
+ /** Whether the initial response was sent. */
106
+ replied: boolean;
107
+ /** Whether the initial response was deferred. */
108
+ deferred: boolean;
109
+ /** Creates an interaction from a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @throws {TypeError} If required identifiers are missing. */
110
+ constructor(client: InteractionClient, data: TData);
79
111
  /** Whether this interaction is any application command: slash or context menu. */
80
112
  isCommand(): this is CommandInteraction;
81
113
  /**
@@ -103,17 +135,28 @@ export declare class Interaction<TData extends InteractionData = InteractionData
103
135
  customId?: string;
104
136
  filter?: (interaction: ModalSubmitInteraction) => boolean | Promise<boolean>;
105
137
  }): Promise<ModalSubmitInteraction>;
106
- /** Whether this interaction is a message component. @returns True for component interactions. */ isMessageComponent(): this is ComponentInteraction;
107
- /** Whether this interaction is a modal submission. @returns True for modal submissions. */ isModalSubmit(): this is ModalSubmitInteraction;
108
- /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */ isAutocomplete(): this is AutocompleteInteraction;
109
- /** Whether this is a button interaction. */ isButton(): this is ComponentInteraction;
110
- /** Whether this is a string select menu interaction. */ isStringSelectMenu(): this is ComponentInteraction;
111
- /** Whether this is a user select menu interaction. */ isUserSelectMenu(): this is ComponentInteraction;
112
- /** Whether this is a role select menu interaction. */ isRoleSelectMenu(): this is ComponentInteraction;
113
- /** Whether this is a mentionable select menu interaction. */ isMentionableSelectMenu(): this is ComponentInteraction;
114
- /** Whether this is a channel select menu interaction. */ isChannelSelectMenu(): this is ComponentInteraction;
115
- /** Whether this is any select menu interaction. */ isAnySelectMenu(): this is ComponentInteraction;
116
- /** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */ protected assertUnacknowledged(): void;
138
+ /** Whether this interaction is a message component. @returns True for component interactions. */
139
+ isMessageComponent(): this is ComponentInteraction;
140
+ /** Whether this interaction is a modal submission. @returns True for modal submissions. */
141
+ isModalSubmit(): this is ModalSubmitInteraction;
142
+ /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */
143
+ isAutocomplete(): this is AutocompleteInteraction;
144
+ /** Whether this is a button interaction. */
145
+ isButton(): this is ComponentInteraction;
146
+ /** Whether this is a string select menu interaction. */
147
+ isStringSelectMenu(): this is ComponentInteraction;
148
+ /** Whether this is a user select menu interaction. */
149
+ isUserSelectMenu(): this is ComponentInteraction;
150
+ /** Whether this is a role select menu interaction. */
151
+ isRoleSelectMenu(): this is ComponentInteraction;
152
+ /** Whether this is a mentionable select menu interaction. */
153
+ isMentionableSelectMenu(): this is ComponentInteraction;
154
+ /** Whether this is a channel select menu interaction. */
155
+ isChannelSelectMenu(): this is ComponentInteraction;
156
+ /** Whether this is any select menu interaction. */
157
+ isAnySelectMenu(): this is ComponentInteraction;
158
+ /** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */
159
+ protected assertUnacknowledged(): void;
117
160
  /**
118
161
  * Sends the initial response exactly once. The in-flight flag is set
119
162
  * before the request, so two concurrent calls cannot both send; it is
@@ -136,7 +179,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
136
179
  editFollowUp(messageId: string, options: InteractionReplyOptions | string): Promise<unknown>;
137
180
  /** Deletes a follow-up message. @param messageId Follow-up message ID. */
138
181
  deleteFollowUp(messageId: string): Promise<void>;
139
- /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
182
+ /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */
183
+ protected assertAcknowledged(): void;
140
184
  /** Posts a raw interaction response callback. */
141
185
  protected postResponse(response: InteractionResponse): Promise<unknown>;
142
186
  /**
@@ -166,9 +210,12 @@ export declare class Interaction<TData extends InteractionData = InteractionData
166
210
  ephemeral?: boolean;
167
211
  withResponse?: boolean;
168
212
  }): Promise<void>;
169
- /** 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>;
170
- /** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */ deleteReply(): Promise<void>;
171
- /** 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>;
213
+ /** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */
214
+ editReply(options: InteractionReplyOptions): Promise<unknown>;
215
+ /** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */
216
+ deleteReply(): Promise<void>;
217
+ /** Sends a follow-up message using the interaction webhook. @param options Follow-up message options. @returns Discord response. @throws {Error} When REST fails. */
218
+ followUp(options: InteractionReplyOptions | string): Promise<unknown>;
172
219
  /**
173
220
  * Updates the message a component is on. With `withResponse: true` it
174
221
  * returns the updated {@link Message}.
@@ -194,7 +241,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
194
241
  export declare class CommandInteraction extends Interaction {
195
242
  /** Typed option resolver. Access slash command options with full type safety. */
196
243
  readonly options: CommandOptions;
197
- /** Invoked command name. @returns Command name or an empty string. */ get commandName(): string;
244
+ /** Invoked command name. @returns Command name or an empty string. */
245
+ get commandName(): string;
198
246
  constructor(client: InteractionClient, data: InteractionData);
199
247
  }
200
248
  /** A user or message context-menu command, with what was right-clicked. */
@@ -263,7 +311,7 @@ export declare class AutocompleteInteraction extends Interaction {
263
311
  * @throws {TypeError} If required identifiers are missing.
264
312
  */
265
313
  export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
266
- /** @deprecated Use {@link InteractionEnum}. Removed in 2.0. */
314
+ /** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
267
315
  export declare const InteractionType: {
268
316
  readonly Ping: 1;
269
317
  readonly ApplicationCommand: 2;
@@ -271,5 +319,5 @@ export declare const InteractionType: {
271
319
  readonly ApplicationCommandAutocomplete: 4;
272
320
  readonly ModalSubmit: 5;
273
321
  };
274
- /** @deprecated Use {@link InteractionEnum}. Removed in 2.0. */
322
+ /** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
275
323
  export type InteractionType = InteractionEnum;
@@ -4,16 +4,26 @@ import type { ImageURLOptions, ResourceContext } from "./base.js";
4
4
  /** A Discord guild member. */
5
5
  export declare class GuildMember {
6
6
  #private;
7
- /** User represented by the member. */ readonly user: User;
8
- /** Guild containing the member. */ readonly guildId: string;
9
- /** Nickname, if configured. */ nickname: string | null;
10
- /** Role IDs assigned to the member. */ readonly roleIds: string[];
11
- /** Whether the member is pending membership screening. */ pending: boolean;
12
- /** Member join timestamp. */ joinedAt?: Date;
13
- /** Member-specific avatar hash, if set. */ avatarHash: string | null;
14
- /** When the member started boosting the guild. */ premiumSince: Date | null;
15
- /** When the member's timeout expires (null if not timed out). */ timedOutUntil: Date | null;
16
- /** Member flags bitfield. */ flags: number;
7
+ /** User represented by the member. */
8
+ readonly user: User;
9
+ /** Guild containing the member. */
10
+ readonly guildId: string;
11
+ /** Nickname, if configured. */
12
+ nickname: string | null;
13
+ /** Role IDs assigned to the member. */
14
+ readonly roleIds: string[];
15
+ /** Whether the member is pending membership screening. */
16
+ pending: boolean;
17
+ /** Member join timestamp. */
18
+ joinedAt?: Date;
19
+ /** Member-specific avatar hash, if set. */
20
+ avatarHash: string | null;
21
+ /** When the member started boosting the guild. */
22
+ premiumSince: Date | null;
23
+ /** When the member's timeout expires (null if not timed out). */
24
+ timedOutUntil: Date | null;
25
+ /** Member flags bitfield. */
26
+ flags: number;
17
27
  /** Creates a guild member from Discord data. @param data Discord guild-member payload. @throws {TypeError} If the guild ID is invalid. @throws {RangeError} If joined_at is invalid. */
18
28
  constructor(data: {
19
29
  user: {
@@ -76,16 +86,26 @@ export declare class GuildMember {
76
86
  }
77
87
  /** A Discord guild role. */
78
88
  export declare class Role extends BaseStructure {
79
- /** Role name. */ name: string;
80
- /** Role color as a 24-bit RGB integer. */ color: number;
81
- /** Whether the role is hoisted. */ hoist: boolean;
82
- /** Permission bitfield. */ permissions: PermissionsBitField;
83
- /** Whether the role is managed by an integration. */ managed: boolean;
84
- /** Whether the role is mentionable. */ mentionable: boolean;
85
- /** Role position in the hierarchy. */ position: number;
86
- /** Unicode emoji used as the role icon, if any. */ unicodeEmoji: string | null;
87
- /** Hash of the role's custom icon image, if any. */ iconHash: string | null;
88
- /** Role tags metadata (bot, premium subscriber, etc). */ tags: Record<string, unknown> | null;
89
+ /** Role name. */
90
+ name: string;
91
+ /** Role color as a 24-bit RGB integer. */
92
+ color: number;
93
+ /** Whether the role is hoisted. */
94
+ hoist: boolean;
95
+ /** Permission bitfield. */
96
+ permissions: PermissionsBitField;
97
+ /** Whether the role is managed by an integration. */
98
+ managed: boolean;
99
+ /** Whether the role is mentionable. */
100
+ mentionable: boolean;
101
+ /** Role position in the hierarchy. */
102
+ position: number;
103
+ /** Unicode emoji used as the role icon, if any. */
104
+ unicodeEmoji: string | null;
105
+ /** Hash of the role's custom icon image, if any. */
106
+ iconHash: string | null;
107
+ /** Role tags metadata (bot, premium subscriber, etc). */
108
+ tags: Record<string, unknown> | null;
89
109
  /** Creates a role from Discord data. @param data Discord role payload. */
90
110
  constructor(data: {
91
111
  id: string;
@@ -124,16 +144,26 @@ export declare class TextChannel extends Channel {
124
144
  }
125
145
  /** A Discord invite link and its metadata. */
126
146
  export declare class Invite {
127
- /** Invite code (the unique part of the URL). */ readonly code: string;
128
- /** Guild this invite belongs to, if any. */ readonly guildId: string | null;
129
- /** Channel this invite points to, if any. */ readonly channelId: string | null;
130
- /** User who created the invite, if available. */ readonly inviter: User | null;
131
- /** Number of times the invite has been used. */ uses: number;
132
- /** Maximum number of uses (0 = unlimited). */ maxUses: number;
133
- /** Duration in seconds until the invite expires (0 = never). */ maxAge: number;
134
- /** Whether the invite is temporary (kicks uninducted members on disconnect). */ temporary: boolean;
135
- /** When the invite was created. */ readonly createdAt: Date | null;
136
- /** When the invite expires, or null if it never expires. */ readonly expiresAt: Date | null;
147
+ /** Invite code (the unique part of the URL). */
148
+ readonly code: string;
149
+ /** Guild this invite belongs to, if any. */
150
+ readonly guildId: string | null;
151
+ /** Channel this invite points to, if any. */
152
+ readonly channelId: string | null;
153
+ /** User who created the invite, if available. */
154
+ readonly inviter: User | null;
155
+ /** Number of times the invite has been used. */
156
+ uses: number;
157
+ /** Maximum number of uses (0 = unlimited). */
158
+ maxUses: number;
159
+ /** Duration in seconds until the invite expires (0 = never). */
160
+ maxAge: number;
161
+ /** Whether the invite is temporary (kicks uninducted members on disconnect). */
162
+ temporary: boolean;
163
+ /** When the invite was created. */
164
+ readonly createdAt: Date | null;
165
+ /** When the invite expires, or null if it never expires. */
166
+ readonly expiresAt: Date | null;
137
167
  /** Creates an invite from Discord data. */
138
168
  constructor(data: {
139
169
  code: string;
@@ -175,13 +205,20 @@ export declare const WebhookEnum: {
175
205
  export type WebhookEnum = (typeof WebhookEnum)[keyof typeof WebhookEnum];
176
206
  /** A Discord webhook — an HTTP endpoint that can post messages to a channel. */
177
207
  export declare class Webhook extends BaseStructure {
178
- /** Webhook type. */ readonly type: number;
179
- /** Webhook display name. */ name: string | null;
180
- /** Webhook avatar hash. */ avatarHash: string | null;
181
- /** Channel this webhook posts to. */ readonly channelId: string | null;
182
- /** Guild this webhook belongs to. */ readonly guildId: string | null;
183
- /** Application that created this webhook, if any. */ readonly applicationId: string | null;
184
- /** Webhook token (only present for incoming webhooks). */ readonly token: string | null;
208
+ /** Webhook type. */
209
+ readonly type: number;
210
+ /** Webhook display name. */
211
+ name: string | null;
212
+ /** Webhook avatar hash. */
213
+ avatarHash: string | null;
214
+ /** Channel this webhook posts to. */
215
+ readonly channelId: string | null;
216
+ /** Guild this webhook belongs to. */
217
+ readonly guildId: string | null;
218
+ /** Application that created this webhook, if any. */
219
+ readonly applicationId: string | null;
220
+ /** Webhook token (only present for incoming webhooks). */
221
+ readonly token: string | null;
185
222
  /** Creates a webhook from Discord data. */
186
223
  constructor(data: {
187
224
  id: string;
@@ -202,13 +239,20 @@ export declare class Webhook extends BaseStructure {
202
239
  }
203
240
  /** A Discord emoji. */
204
241
  export declare class Emoji extends BaseStructure {
205
- /** Emoji name. */ name: string | null;
206
- /** Roles allowed to use this emoji. */ roleIds: string[];
207
- /** User that created this emoji. */ user: User | null;
208
- /** Whether this emoji must be wrapped in colons. */ requireColons: boolean;
209
- /** Whether this emoji is managed. */ managed: boolean;
210
- /** Whether this emoji is animated. */ animated: boolean;
211
- /** Whether this emoji can be used, may be false due to loss of Server Boosts. */ available: boolean;
242
+ /** Emoji name. */
243
+ name: string | null;
244
+ /** Roles allowed to use this emoji. */
245
+ roleIds: string[];
246
+ /** User that created this emoji. */
247
+ user: User | null;
248
+ /** Whether this emoji must be wrapped in colons. */
249
+ requireColons: boolean;
250
+ /** Whether this emoji is managed. */
251
+ managed: boolean;
252
+ /** Whether this emoji is animated. */
253
+ animated: boolean;
254
+ /** Whether this emoji can be used, may be false due to loss of Server Boosts. */
255
+ available: boolean;
212
256
  /** Creates an emoji from Discord data. */
213
257
  constructor(data: {
214
258
  id: string | null;
@@ -282,11 +326,11 @@ export declare class GuildOnboarding extends BaseStructure {
282
326
  mode: number;
283
327
  constructor(data: import("@lunibee/types").APIGuildOnboarding);
284
328
  }
285
- /** @deprecated Use {@link WebhookEnum}. Removed in 2.0. */
329
+ /** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
286
330
  export declare const WebhookType: {
287
331
  readonly Incoming: 1;
288
332
  readonly ChannelFollower: 2;
289
333
  readonly Application: 3;
290
334
  };
291
- /** @deprecated Use {@link WebhookEnum}. Removed in 2.0. */
335
+ /** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
292
336
  export type WebhookType = WebhookEnum;
@@ -138,7 +138,7 @@ export interface GatewayProperties {
138
138
  os?: string;
139
139
  browser?: string;
140
140
  device?: string;
141
- [key: string]: unknown;
141
+ [key: string]: string | undefined;
142
142
  }
143
143
  /** Gateway presence activity. */
144
144
  export interface GatewayPresenceActivity {
@@ -250,6 +250,25 @@ export type APIMessageComponent = APIActionRowComponent | {
250
250
  type: Exclude<number, 1>;
251
251
  [key: string]: any;
252
252
  };
253
+ /** A Discord payload, or a builder that serialises to one (its `toJSON()` runs when the request is sent). */
254
+ export type Buildable<T> = T | {
255
+ toJSON(): T;
256
+ };
257
+ /**
258
+ * A message Lunibee sends: channel send and edit, message reply and edit,
259
+ * interaction replies, follow-ups and updates. Embeds and components may be
260
+ * builders or raw objects. Other Discord fields pass through unchanged.
261
+ */
262
+ export interface MessagePayload {
263
+ content?: string;
264
+ embeds?: Buildable<APIEmbed>[];
265
+ components?: Buildable<APIMessageComponent>[];
266
+ allowed_mentions?: import("./gateway.js").AllowedMentions;
267
+ /** Discord message flags, e.g. `MessageFlags.SuppressEmbeds`. */
268
+ flags?: number;
269
+ tts?: boolean;
270
+ [key: string]: unknown;
271
+ }
253
272
  /** Raw Discord attachment object. */
254
273
  export interface APIAttachment {
255
274
  id: Snowflake;
@@ -845,7 +864,10 @@ export interface APIApplicationCommand {
845
864
  description: string;
846
865
  options?: APIApplicationCommandOption[];
847
866
  default_member_permissions?: string | null;
867
+ /** @deprecated Discord deprecated this field. Use `contexts`. Removed in 0.3.0. */
848
868
  dm_permission?: boolean;
869
+ /** Where the command can be used: 0 guilds, 1 the bot's DMs, 2 other DMs. */
870
+ contexts?: number[];
849
871
  nsfw?: boolean;
850
872
  version: Snowflake;
851
873
  }
@@ -856,7 +878,10 @@ export interface ApplicationCommandData {
856
878
  type?: number;
857
879
  options?: APIApplicationCommandOption[];
858
880
  default_member_permissions?: string | null;
881
+ /** @deprecated Discord deprecated this field. Use `contexts`. Removed in 0.3.0. */
859
882
  dm_permission?: boolean;
883
+ /** Where the command can be used: 0 guilds, 1 the bot's DMs, 2 other DMs. */
884
+ contexts?: number[];
860
885
  nsfw?: boolean;
861
886
  }
862
887
  /** A channel permission overwrite for a role (type 0) or member (type 1). */
@@ -913,7 +938,7 @@ export interface APISubscription {
913
938
  canceled_at: string | null;
914
939
  country?: string;
915
940
  }
916
- /** @deprecated Use {@link ButtonType}. Removed in 2.0. */
941
+ /** @deprecated Use {@link ButtonType}. Removed in 0.3.0. */
917
942
  export declare const ButtonStyle: {
918
943
  readonly Primary: 1;
919
944
  readonly Secondary: 2;
@@ -922,16 +947,16 @@ export declare const ButtonStyle: {
922
947
  readonly Link: 5;
923
948
  readonly Premium: 6;
924
949
  };
925
- /** @deprecated Use {@link ButtonType}. Removed in 2.0. */
950
+ /** @deprecated Use {@link ButtonType}. Removed in 0.3.0. */
926
951
  export type ButtonStyle = ButtonType;
927
- /** @deprecated Use {@link TextInputType}. Removed in 2.0. */
952
+ /** @deprecated Use {@link TextInputType}. Removed in 0.3.0. */
928
953
  export declare const TextInputStyle: {
929
954
  readonly Short: 1;
930
955
  readonly Paragraph: 2;
931
956
  };
932
- /** @deprecated Use {@link TextInputType}. Removed in 2.0. */
957
+ /** @deprecated Use {@link TextInputType}. Removed in 0.3.0. */
933
958
  export type TextInputStyle = TextInputType;
934
- /** @deprecated Use {@link ChannelEnum}. Removed in 2.0. */
959
+ /** @deprecated Use {@link ChannelEnum}. Removed in 0.3.0. */
935
960
  export declare const ChannelType: {
936
961
  readonly GuildText: 0;
937
962
  readonly DM: 1;
@@ -947,9 +972,9 @@ export declare const ChannelType: {
947
972
  readonly GuildForum: 15;
948
973
  readonly GuildMedia: 16;
949
974
  };
950
- /** @deprecated Use {@link ChannelEnum}. Removed in 2.0. */
975
+ /** @deprecated Use {@link ChannelEnum}. Removed in 0.3.0. */
951
976
  export type ChannelType = ChannelEnum;
952
- /** @deprecated Use {@link ComponentEnum}. Removed in 2.0. */
977
+ /** @deprecated Use {@link ComponentEnum}. Removed in 0.3.0. */
953
978
  export declare const ComponentType: {
954
979
  readonly ActionRow: 1;
955
980
  readonly Button: 2;
@@ -968,9 +993,9 @@ export declare const ComponentType: {
968
993
  readonly ContentInventoryEntry: 16;
969
994
  readonly Container: 17;
970
995
  };
971
- /** @deprecated Use {@link ComponentEnum}. Removed in 2.0. */
996
+ /** @deprecated Use {@link ComponentEnum}. Removed in 0.3.0. */
972
997
  export type ComponentType = ComponentEnum;
973
- /** @deprecated Use {@link InteractionResponseEnum}. Removed in 2.0. */
998
+ /** @deprecated Use {@link InteractionResponseEnum}. Removed in 0.3.0. */
974
999
  export declare const InteractionResponseType: {
975
1000
  readonly Pong: 1;
976
1001
  readonly ChannelMessage: 4;
@@ -980,17 +1005,17 @@ export declare const InteractionResponseType: {
980
1005
  readonly Autocomplete: 8;
981
1006
  readonly Modal: 9;
982
1007
  };
983
- /** @deprecated Use {@link InteractionResponseEnum}. Removed in 2.0. */
1008
+ /** @deprecated Use {@link InteractionResponseEnum}. Removed in 0.3.0. */
984
1009
  export type InteractionResponseType = InteractionResponseEnum;
985
- /** @deprecated Use {@link ApplicationCommandEnum}. Removed in 2.0. */
1010
+ /** @deprecated Use {@link ApplicationCommandEnum}. Removed in 0.3.0. */
986
1011
  export declare const ApplicationCommandType: {
987
1012
  readonly ChatInput: 1;
988
1013
  readonly User: 2;
989
1014
  readonly Message: 3;
990
1015
  };
991
- /** @deprecated Use {@link ApplicationCommandEnum}. Removed in 2.0. */
1016
+ /** @deprecated Use {@link ApplicationCommandEnum}. Removed in 0.3.0. */
992
1017
  export type ApplicationCommandType = ApplicationCommandEnum;
993
- /** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 2.0. */
1018
+ /** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 0.3.0. */
994
1019
  export declare const ApplicationCommandOptionType: {
995
1020
  readonly SubCommand: 1;
996
1021
  readonly SubCommandGroup: 2;
@@ -1004,21 +1029,21 @@ export declare const ApplicationCommandOptionType: {
1004
1029
  readonly Number: 10;
1005
1030
  readonly Attachment: 11;
1006
1031
  };
1007
- /** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 2.0. */
1032
+ /** @deprecated Use {@link ApplicationCommandOptionEnum}. Removed in 0.3.0. */
1008
1033
  export type ApplicationCommandOptionType = ApplicationCommandOptionEnum;
1009
- /** @deprecated Use {@link StickerEnum}. Removed in 2.0. */
1034
+ /** @deprecated Use {@link StickerEnum}. Removed in 0.3.0. */
1010
1035
  export declare const StickerType: {
1011
1036
  readonly Standard: 1;
1012
1037
  readonly Guild: 2;
1013
1038
  };
1014
- /** @deprecated Use {@link StickerEnum}. Removed in 2.0. */
1039
+ /** @deprecated Use {@link StickerEnum}. Removed in 0.3.0. */
1015
1040
  export type StickerType = StickerEnum;
1016
- /** @deprecated Use {@link StickerFormatEnum}. Removed in 2.0. */
1041
+ /** @deprecated Use {@link StickerFormatEnum}. Removed in 0.3.0. */
1017
1042
  export declare const StickerFormatType: {
1018
1043
  readonly PNG: 1;
1019
1044
  readonly APNG: 2;
1020
1045
  readonly Lottie: 3;
1021
1046
  readonly GIF: 4;
1022
1047
  };
1023
- /** @deprecated Use {@link StickerFormatEnum}. Removed in 2.0. */
1048
+ /** @deprecated Use {@link StickerFormatEnum}. Removed in 0.3.0. */
1024
1049
  export type StickerFormatType = StickerFormatEnum;
@@ -53,28 +53,26 @@ var IntentBits = {
53
53
  };
54
54
  var Intents = IntentBits;
55
55
  function resolveGatewayIntents(intents) {
56
- if (typeof intents === "number")
57
- return intents;
58
- if (intents && typeof intents === "object" && !Array.isArray(intents))
56
+ if (Array.isArray(intents))
57
+ return intents.reduce((acc, intent) => acc | resolveIntent(intent), 0);
58
+ if (typeof intents === "object")
59
59
  return intents.bitfield;
60
- if (Array.isArray(intents)) {
61
- return intents.reduce((acc, intent) => {
62
- return acc | resolveGatewayIntents(intent);
63
- }, 0);
64
- }
65
- if (typeof intents === "string") {
66
- if (intents in GatewayIntentBits)
67
- return GatewayIntentBits[intents];
68
- if (intents in IntentBits)
69
- return IntentBits[intents];
70
- const lower = intents.charAt(0).toLowerCase() + intents.slice(1);
71
- if (lower in IntentBits)
72
- return IntentBits[lower];
73
- const num = Number(intents);
74
- if (!Number.isNaN(num))
75
- return num;
76
- }
77
- return 0;
60
+ return resolveIntent(intents);
61
+ }
62
+ function resolveIntent(intent) {
63
+ if (typeof intent === "number")
64
+ return intent;
65
+ const bits = {
66
+ ...IntentBits,
67
+ ...GatewayIntentBits
68
+ };
69
+ const lower = intent.charAt(0).toLowerCase() + intent.slice(1);
70
+ if (Object.hasOwn(bits, intent))
71
+ return bits[intent];
72
+ if (Object.hasOwn(bits, lower))
73
+ return bits[lower];
74
+ const num = Number(intent);
75
+ return Number.isNaN(num) ? 0 : num;
78
76
  }
79
77
 
80
78
  class IntentsBitField {
@@ -268,4 +266,4 @@ export {
268
266
  resolveGatewayIntents
269
267
  };
270
268
 
271
- //# debugId=40CBDDAEDFA8DAF664756E2164756E21
269
+ //# debugId=9EEF77311C3CC22364756E2164756E21