lunibee 0.2.3 → 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 (61) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +225 -225
  3. package/dist/builders/attachment.d.ts +8 -0
  4. package/dist/builders/commands.d.ts +122 -65
  5. package/dist/builders/components.d.ts +10 -31
  6. package/dist/builders/embed.d.ts +66 -33
  7. package/dist/builders/index.js +97 -131
  8. package/dist/builders/index.js.map +8 -8
  9. package/dist/collection/cache.d.ts +13 -6
  10. package/dist/collection/index.d.ts +90 -17
  11. package/dist/collection/index.js +442 -266
  12. package/dist/collection/index.js.map +4 -4
  13. package/dist/core/index.d.ts +8 -0
  14. package/dist/core/index.js +607 -352
  15. package/dist/core/index.js.map +47 -47
  16. package/dist/core/permissions.d.ts +7 -3
  17. package/dist/formatters/index.js +9 -5
  18. package/dist/formatters/index.js.map +3 -3
  19. package/dist/handlers/index.js +5 -10
  20. package/dist/handlers/index.js.map +3 -3
  21. package/dist/index.js +769 -587
  22. package/dist/index.js.map +65 -65
  23. package/dist/managers/base.d.ts +22 -14
  24. package/dist/managers/index.d.ts +2 -1
  25. package/dist/managers/index.js +445 -276
  26. package/dist/managers/index.js.map +26 -26
  27. package/dist/managers/message.d.ts +7 -3
  28. package/dist/rest/errors.d.ts +14 -7
  29. package/dist/rest/index.d.ts +24 -12
  30. package/dist/rest/index.js +54 -17
  31. package/dist/rest/index.js.map +14 -14
  32. package/dist/rest/redis.d.ts +1 -1
  33. package/dist/rest/route.d.ts +8 -4
  34. package/dist/rest/routes.d.ts +102 -48
  35. package/dist/rest/transport.d.ts +10 -5
  36. package/dist/rest/webhook.d.ts +9 -5
  37. package/dist/sharding/bus.d.ts +34 -17
  38. package/dist/sharding/index.d.ts +34 -17
  39. package/dist/sharding/index.js +64 -32
  40. package/dist/sharding/index.js.map +17 -17
  41. package/dist/structures/base.d.ts +19 -10
  42. package/dist/structures/channels.d.ts +28 -14
  43. package/dist/structures/index.js +9 -59
  44. package/dist/structures/index.js.map +19 -18
  45. package/dist/structures/interactions.d.ts +96 -48
  46. package/dist/structures/resources.d.ts +88 -44
  47. package/dist/types/gateway.d.ts +1 -1
  48. package/dist/types/index.js +20 -22
  49. package/dist/types/index.js.map +4 -4
  50. package/dist/utils/index.js.map +2 -2
  51. package/dist/voice/index.d.ts +12 -4
  52. package/dist/voice/index.js +14 -18
  53. package/dist/voice/index.js.map +3 -3
  54. package/dist/ws/decoder.d.ts +6 -2
  55. package/dist/ws/index.d.ts +25 -13
  56. package/dist/ws/index.js +63 -31
  57. package/dist/ws/index.js.map +14 -14
  58. package/dist/ws/protocol.d.ts +10 -2
  59. package/dist/ws/session.d.ts +14 -4
  60. package/dist/ws/state.d.ts +22 -11
  61. package/package.json +15 -14
@@ -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. */
@@ -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;
@@ -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 {
@@ -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