lunibee 0.2.3 → 0.3.0

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 (86) hide show
  1. package/README.md +3 -3
  2. package/dist/builders/attachment.d.ts +8 -4
  3. package/dist/builders/commands.d.ts +122 -149
  4. package/dist/builders/components.d.ts +10 -150
  5. package/dist/builders/embed.d.ts +66 -37
  6. package/dist/builders/index.d.ts +0 -4
  7. package/dist/builders/index.js +112 -221
  8. package/dist/builders/index.js.map +10 -9
  9. package/dist/collection/cache.d.ts +15 -6
  10. package/dist/collection/index.d.ts +92 -17
  11. package/dist/collection/index.js +471 -279
  12. package/dist/collection/index.js.map +4 -4
  13. package/dist/core/api.d.ts +130 -0
  14. package/dist/core/channel-create.d.ts +72 -0
  15. package/dist/core/commands.d.ts +232 -0
  16. package/dist/core/events.d.ts +24 -7
  17. package/dist/core/handles.d.ts +157 -0
  18. package/dist/core/index.d.ts +68 -4
  19. package/dist/core/index.js +2639 -493
  20. package/dist/core/index.js.map +47 -37
  21. package/dist/core/permissions.d.ts +7 -7
  22. package/dist/formatters/index.js +9 -5
  23. package/dist/formatters/index.js.map +3 -3
  24. package/dist/handlers/index.js +5 -10
  25. package/dist/handlers/index.js.map +3 -3
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +9527 -7809
  28. package/dist/index.js.map +63 -53
  29. package/dist/managers/advanced.d.ts +29 -1
  30. package/dist/managers/base.d.ts +22 -14
  31. package/dist/managers/emoji.d.ts +0 -2
  32. package/dist/managers/guild-resources.d.ts +13 -5
  33. package/dist/managers/guild.d.ts +40 -4
  34. package/dist/managers/index.d.ts +21 -13
  35. package/dist/managers/index.js +969 -386
  36. package/dist/managers/index.js.map +30 -25
  37. package/dist/managers/member.d.ts +9 -2
  38. package/dist/managers/message.d.ts +10 -15
  39. package/dist/managers/role.d.ts +18 -10
  40. package/dist/managers/thread.d.ts +68 -0
  41. package/dist/managers/user.d.ts +18 -0
  42. package/dist/rest/errors.d.ts +14 -7
  43. package/dist/rest/index.d.ts +24 -12
  44. package/dist/rest/index.js +70 -20
  45. package/dist/rest/index.js.map +9 -9
  46. package/dist/rest/redis.d.ts +1 -1
  47. package/dist/rest/route.d.ts +8 -4
  48. package/dist/rest/routes.d.ts +122 -48
  49. package/dist/rest/transport.d.ts +10 -5
  50. package/dist/rest/webhook.d.ts +9 -5
  51. package/dist/sharding/bus.d.ts +47 -19
  52. package/dist/sharding/cluster.d.ts +11 -0
  53. package/dist/sharding/gateway-bot.d.ts +18 -0
  54. package/dist/sharding/index.d.ts +64 -25
  55. package/dist/sharding/index.js +439 -124
  56. package/dist/sharding/index.js.map +19 -14
  57. package/dist/sharding/supervisor.d.ts +32 -0
  58. package/dist/sharding/transport.d.ts +45 -0
  59. package/dist/structures/audit-log.d.ts +99 -2
  60. package/dist/structures/base.d.ts +40 -23
  61. package/dist/structures/channels.d.ts +45 -14
  62. package/dist/structures/index.d.ts +8 -12
  63. package/dist/structures/index.js +280 -132
  64. package/dist/structures/index.js.map +21 -15
  65. package/dist/structures/interactions.d.ts +91 -63
  66. package/dist/structures/resources.d.ts +99 -52
  67. package/dist/structures/sticker.d.ts +33 -0
  68. package/dist/types/channel-kind.d.ts +26 -0
  69. package/dist/types/gateway.d.ts +24 -12
  70. package/dist/types/index.d.ts +115 -113
  71. package/dist/types/index.js +53 -48
  72. package/dist/types/index.js.map +6 -5
  73. package/dist/voice/index.d.ts +12 -4
  74. package/dist/voice/index.js +14 -18
  75. package/dist/voice/index.js.map +3 -3
  76. package/dist/ws/decoder.d.ts +6 -2
  77. package/dist/ws/dispatcher.d.ts +19 -0
  78. package/dist/ws/index.d.ts +61 -15
  79. package/dist/ws/index.js +194 -77
  80. package/dist/ws/index.js.map +13 -11
  81. package/dist/ws/protocol.d.ts +10 -2
  82. package/dist/ws/reconnect.d.ts +10 -0
  83. package/dist/ws/send-budget.d.ts +6 -2
  84. package/dist/ws/session.d.ts +14 -4
  85. package/dist/ws/state.d.ts +22 -11
  86. package/package.json +20 -16
@@ -1,3 +1,4 @@
1
+ import { type APIEntitlement, type InteractionReplyOptions } from "@lunibee/types";
1
2
  import { User, type ResourceContext } from "./base.js";
2
3
  import { GuildMember } from "./resources.js";
3
4
  import { Message } from "./index.js";
@@ -11,35 +12,38 @@ export declare const InteractionEnum: {
11
12
  };
12
13
  /** One {@link InteractionEnum} value, usable as a type. */
13
14
  export type InteractionEnum = (typeof InteractionEnum)[keyof typeof InteractionEnum];
14
- export { InteractionResponseEnum, InteractionResponseType, } from "@lunibee/types";
15
+ export { InteractionResponseEnum } from "@lunibee/types";
15
16
  /** Data shared by Discord interactions. */
16
17
  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>;
25
- [key: string]: unknown;
26
- }
27
- /** Options for an interaction response message. */
28
- 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;
18
+ /** Interaction identifier. */
19
+ id: string;
20
+ /** Application identifier. */
21
+ application_id: string;
22
+ /** Interaction type. */
23
+ type: number;
24
+ /** Interaction token. */
25
+ token: string;
26
+ /** Gateway/API version. */
27
+ version?: number;
28
+ /** Guild identifier. */
29
+ guild_id?: string;
30
+ /** Channel identifier. */
31
+ channel_id?: string;
32
+ /** Interaction-specific data. */
33
+ data?: Record<string, unknown>;
35
34
  [key: string]: unknown;
36
35
  }
36
+ export type { InteractionReplyOptions };
37
37
  /** Transport required by an interaction structure. */
38
38
  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>;
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. */
40
+ postInteractionResponse(id: string, token: string, response: InteractionResponse): Promise<unknown>;
41
+ /** Edits the original interaction response. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
42
+ editInteractionReply(token: string, data: InteractionReplyOptions): Promise<unknown>;
43
+ /** Deletes the original interaction response. @param token Interaction token. @returns Promise fulfilled after deletion. @throws {Error} When REST fails. */
44
+ deleteInteractionReply(token: string): Promise<void>;
45
+ /** Sends a follow-up interaction webhook message. @param token Interaction token. @param data Message payload. @returns Discord response. @throws {Error} When REST fails. */
46
+ followUpInteraction(token: string, data: InteractionReplyOptions): Promise<unknown>;
43
47
  /** 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
48
  interactionWebhookMessage?(method: "GET" | "PATCH" | "DELETE", applicationId: string, token: string, messageId: string, data?: InteractionReplyOptions): Promise<unknown>;
45
49
  /** Lets structures built from an interaction (such as {@link Interaction.member}) act through the client. Optional. */
@@ -55,27 +59,45 @@ export declare class InteractionResponse {
55
59
  withResponse: boolean;
56
60
  /** Creates a response payload. @param type Discord callback type. @param data Optional callback data. @throws {TypeError} If type is not finite. */
57
61
  constructor(type: number, data?: InteractionReplyOptions);
58
- /** Serializes the response for Discord. @returns Discord callback payload. */ toJSON(): {
62
+ /** Serializes the response for Discord. @returns Discord callback payload. */
63
+ toJSON(): {
59
64
  type: number;
60
65
  data?: InteractionReplyOptions;
61
66
  };
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;
67
+ /** Creates an immediate message response. @param options Response message options. @returns Callback payload. */
68
+ static message(options: InteractionReplyOptions): InteractionResponse;
69
+ /** Creates a deferred channel response. @param ephemeral Whether the eventual response is ephemeral. @returns Callback payload. */
70
+ static defer(ephemeral?: boolean): InteractionResponse;
71
+ /** Creates a Pong response. @returns Callback payload. */
72
+ static pong(): InteractionResponse;
65
73
  }
66
74
  /** Base interaction structure. */
67
75
  export declare class Interaction<TData extends InteractionData = InteractionData> {
68
76
  #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);
77
+ /** Interaction identifier. */
78
+ readonly id: string;
79
+ /** Application identifier. */
80
+ readonly applicationId: string;
81
+ /** Interaction token. */
82
+ readonly token: string;
83
+ /** Guild identifier. */
84
+ readonly guildId?: string;
85
+ /** Channel identifier. */
86
+ readonly channelId?: string;
87
+ /** Interaction type. */
88
+ readonly type: number;
89
+ /** Raw interaction data. */
90
+ readonly data: TData;
91
+ /** Whether the initial response was sent. */
92
+ replied: boolean;
93
+ /** Whether the initial response was deferred. */
94
+ deferred: boolean;
95
+ /** Creates an interaction from a Gateway payload. @param client Interaction transport. @param data Gateway interaction payload. @throws {TypeError} If required identifiers are missing. */
96
+ constructor(client: InteractionClient, data: TData);
97
+ /** The entitlements of the person (and guild) that ran this interaction: what they own from your SKUs. */
98
+ get entitlements(): readonly APIEntitlement[];
99
+ /** Whether the interaction carries an active entitlement for a SKU. */
100
+ hasEntitlement(skuId: string): boolean;
79
101
  /** Whether this interaction is any application command: slash or context menu. */
80
102
  isCommand(): this is CommandInteraction;
81
103
  /**
@@ -103,17 +125,28 @@ export declare class Interaction<TData extends InteractionData = InteractionData
103
125
  customId?: string;
104
126
  filter?: (interaction: ModalSubmitInteraction) => boolean | Promise<boolean>;
105
127
  }): 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;
128
+ /** Whether this interaction is a message component. @returns True for component interactions. */
129
+ isMessageComponent(): this is ComponentInteraction;
130
+ /** Whether this interaction is a modal submission. @returns True for modal submissions. */
131
+ isModalSubmit(): this is ModalSubmitInteraction;
132
+ /** Whether this interaction is autocomplete. @returns True for autocomplete interactions. */
133
+ isAutocomplete(): this is AutocompleteInteraction;
134
+ /** Whether this is a button interaction. */
135
+ isButton(): this is ComponentInteraction;
136
+ /** Whether this is a string select menu interaction. */
137
+ isStringSelectMenu(): this is ComponentInteraction;
138
+ /** Whether this is a user select menu interaction. */
139
+ isUserSelectMenu(): this is ComponentInteraction;
140
+ /** Whether this is a role select menu interaction. */
141
+ isRoleSelectMenu(): this is ComponentInteraction;
142
+ /** Whether this is a mentionable select menu interaction. */
143
+ isMentionableSelectMenu(): this is ComponentInteraction;
144
+ /** Whether this is a channel select menu interaction. */
145
+ isChannelSelectMenu(): this is ComponentInteraction;
146
+ /** Whether this is any select menu interaction. */
147
+ isAnySelectMenu(): this is ComponentInteraction;
148
+ /** Ensures the interaction has not already been acknowledged. @returns Nothing. @throws {Error} When already acknowledged. */
149
+ protected assertUnacknowledged(): void;
117
150
  /**
118
151
  * Sends the initial response exactly once. The in-flight flag is set
119
152
  * before the request, so two concurrent calls cannot both send; it is
@@ -136,7 +169,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
136
169
  editFollowUp(messageId: string, options: InteractionReplyOptions | string): Promise<unknown>;
137
170
  /** Deletes a follow-up message. @param messageId Follow-up message ID. */
138
171
  deleteFollowUp(messageId: string): Promise<void>;
139
- /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */ protected assertAcknowledged(): void;
172
+ /** Ensures the interaction has been acknowledged. @returns Nothing. @throws {Error} When not acknowledged. */
173
+ protected assertAcknowledged(): void;
140
174
  /** Posts a raw interaction response callback. */
141
175
  protected postResponse(response: InteractionResponse): Promise<unknown>;
142
176
  /**
@@ -166,9 +200,12 @@ export declare class Interaction<TData extends InteractionData = InteractionData
166
200
  ephemeral?: boolean;
167
201
  withResponse?: boolean;
168
202
  }): 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>;
203
+ /** Edits the original response. @param options Replacement message options. @returns Discord response. @throws {Error} When not acknowledged or REST fails. */
204
+ editReply(options: InteractionReplyOptions): Promise<unknown>;
205
+ /** Deletes the original response. @returns Promise fulfilled after deletion. @throws {Error} When not acknowledged or REST fails. */
206
+ deleteReply(): Promise<void>;
207
+ /** Sends a follow-up message using the interaction webhook. @param options Follow-up message options. @returns Discord response. @throws {Error} When REST fails. */
208
+ followUp(options: InteractionReplyOptions | string): Promise<unknown>;
172
209
  /**
173
210
  * Updates the message a component is on. With `withResponse: true` it
174
211
  * returns the updated {@link Message}.
@@ -194,7 +231,8 @@ export declare class Interaction<TData extends InteractionData = InteractionData
194
231
  export declare class CommandInteraction extends Interaction {
195
232
  /** Typed option resolver. Access slash command options with full type safety. */
196
233
  readonly options: CommandOptions;
197
- /** Invoked command name. @returns Command name or an empty string. */ get commandName(): string;
234
+ /** Invoked command name. @returns Command name or an empty string. */
235
+ get commandName(): string;
198
236
  constructor(client: InteractionClient, data: InteractionData);
199
237
  }
200
238
  /** A user or message context-menu command, with what was right-clicked. */
@@ -263,13 +301,3 @@ export declare class AutocompleteInteraction extends Interaction {
263
301
  * @throws {TypeError} If required identifiers are missing.
264
302
  */
265
303
  export declare function createInteraction(client: InteractionClient, data: InteractionData): Interaction;
266
- /** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
267
- export declare const InteractionType: {
268
- readonly Ping: 1;
269
- readonly ApplicationCommand: 2;
270
- readonly MessageComponent: 3;
271
- readonly ApplicationCommandAutocomplete: 4;
272
- readonly ModalSubmit: 5;
273
- };
274
- /** @deprecated Use {@link InteractionEnum}. Removed in 0.3.0. */
275
- 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,32 @@ 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
+ /** Gradient or holographic colours, when the role has more than a solid colour. */
108
+ colors: {
109
+ primary: number;
110
+ secondary: number | null;
111
+ tertiary: number | null;
112
+ } | null;
113
+ /** Role tags metadata (bot, premium subscriber, etc). */
114
+ tags: Record<string, unknown> | null;
89
115
  /** Creates a role from Discord data. @param data Discord role payload. */
90
116
  constructor(data: {
91
117
  id: string;
@@ -98,6 +124,11 @@ export declare class Role extends BaseStructure {
98
124
  position?: number;
99
125
  unicode_emoji?: string | null;
100
126
  icon?: string | null;
127
+ colors?: {
128
+ primary_color: number;
129
+ secondary_color: number | null;
130
+ tertiary_color: number | null;
131
+ };
101
132
  tags?: Record<string, unknown> | null;
102
133
  });
103
134
  /** Returns the role's color as a `#RRGGBB` hex string. Returns `#000000` for colorless roles. */
@@ -124,16 +155,26 @@ export declare class TextChannel extends Channel {
124
155
  }
125
156
  /** A Discord invite link and its metadata. */
126
157
  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;
158
+ /** Invite code (the unique part of the URL). */
159
+ readonly code: string;
160
+ /** Guild this invite belongs to, if any. */
161
+ readonly guildId: string | null;
162
+ /** Channel this invite points to, if any. */
163
+ readonly channelId: string | null;
164
+ /** User who created the invite, if available. */
165
+ readonly inviter: User | null;
166
+ /** Number of times the invite has been used. */
167
+ uses: number;
168
+ /** Maximum number of uses (0 = unlimited). */
169
+ maxUses: number;
170
+ /** Duration in seconds until the invite expires (0 = never). */
171
+ maxAge: number;
172
+ /** Whether the invite is temporary (kicks uninducted members on disconnect). */
173
+ temporary: boolean;
174
+ /** When the invite was created. */
175
+ readonly createdAt: Date | null;
176
+ /** When the invite expires, or null if it never expires. */
177
+ readonly expiresAt: Date | null;
137
178
  /** Creates an invite from Discord data. */
138
179
  constructor(data: {
139
180
  code: string;
@@ -175,13 +216,20 @@ export declare const WebhookEnum: {
175
216
  export type WebhookEnum = (typeof WebhookEnum)[keyof typeof WebhookEnum];
176
217
  /** A Discord webhook — an HTTP endpoint that can post messages to a channel. */
177
218
  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;
219
+ /** Webhook type. */
220
+ readonly type: number;
221
+ /** Webhook display name. */
222
+ name: string | null;
223
+ /** Webhook avatar hash. */
224
+ avatarHash: string | null;
225
+ /** Channel this webhook posts to. */
226
+ readonly channelId: string | null;
227
+ /** Guild this webhook belongs to. */
228
+ readonly guildId: string | null;
229
+ /** Application that created this webhook, if any. */
230
+ readonly applicationId: string | null;
231
+ /** Webhook token (only present for incoming webhooks). */
232
+ readonly token: string | null;
185
233
  /** Creates a webhook from Discord data. */
186
234
  constructor(data: {
187
235
  id: string;
@@ -202,13 +250,20 @@ export declare class Webhook extends BaseStructure {
202
250
  }
203
251
  /** A Discord emoji. */
204
252
  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;
253
+ /** Emoji name. */
254
+ name: string | null;
255
+ /** Roles allowed to use this emoji. */
256
+ roleIds: string[];
257
+ /** User that created this emoji. */
258
+ user: User | null;
259
+ /** Whether this emoji must be wrapped in colons. */
260
+ requireColons: boolean;
261
+ /** Whether this emoji is managed. */
262
+ managed: boolean;
263
+ /** Whether this emoji is animated. */
264
+ animated: boolean;
265
+ /** Whether this emoji can be used, may be false due to loss of Server Boosts. */
266
+ available: boolean;
212
267
  /** Creates an emoji from Discord data. */
213
268
  constructor(data: {
214
269
  id: string | null;
@@ -282,11 +337,3 @@ export declare class GuildOnboarding extends BaseStructure {
282
337
  mode: number;
283
338
  constructor(data: import("@lunibee/types").APIGuildOnboarding);
284
339
  }
285
- /** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
286
- export declare const WebhookType: {
287
- readonly Incoming: 1;
288
- readonly ChannelFollower: 2;
289
- readonly Application: 3;
290
- };
291
- /** @deprecated Use {@link WebhookEnum}. Removed in 0.3.0. */
292
- export type WebhookType = WebhookEnum;
@@ -0,0 +1,33 @@
1
+ import { type APISticker, type APIStickerItem, type UserData } from "@lunibee/types";
2
+ import { BaseStructure } from "./base.js";
3
+ /** Where a sticker's image lives on Discord's CDN, by format. Lottie stickers are JSON, GIFs come from the media host. */
4
+ export declare function stickerURL(id: string, format: number, options?: {
5
+ size?: number;
6
+ }): string;
7
+ /** A sticker: a guild's own, one from a Nitro pack, or a standard one. */
8
+ export declare class Sticker extends BaseStructure {
9
+ readonly name: string;
10
+ readonly description: string | null;
11
+ /** Comma-separated autocomplete tags. */
12
+ readonly tags: string;
13
+ /** 1 standard (from a pack), 2 guild. */
14
+ readonly type: number;
15
+ /** 1 PNG, 2 APNG, 3 Lottie, 4 GIF. */
16
+ readonly formatType: number;
17
+ /** Whether the sticker can be used (guild stickers become unavailable when the boost level drops). */
18
+ readonly available: boolean;
19
+ readonly guildId: string | null;
20
+ readonly packId: string | null;
21
+ readonly sortValue: number | null;
22
+ /** Who uploaded it, for guild stickers. */
23
+ readonly user: UserData | null;
24
+ constructor(data: APISticker);
25
+ /** Whether the sticker moves: APNG, Lottie or GIF. */
26
+ get animated(): boolean;
27
+ /** The sticker's image URL (a `.json` file for Lottie). */
28
+ url(options?: {
29
+ size?: number;
30
+ }): string;
31
+ /** The sticker as a message carries it. */
32
+ toItem(): APIStickerItem;
33
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Channel kinds: a short name for what a channel is, in place of the numeric
3
+ * `type` Discord sends. Threads share one kind; `type` still tells the three
4
+ * apart.
5
+ */
6
+ export declare const ChannelKinds: {
7
+ readonly text: readonly [0];
8
+ readonly dm: readonly [1];
9
+ readonly voice: readonly [2];
10
+ readonly "group-dm": readonly [3];
11
+ readonly category: readonly [4];
12
+ readonly announcement: readonly [5];
13
+ readonly thread: readonly [10, 11, 12];
14
+ readonly stage: readonly [13];
15
+ readonly directory: readonly [14];
16
+ readonly forum: readonly [15];
17
+ readonly media: readonly [16];
18
+ };
19
+ /** The name of a kind of channel, such as `"text"` or `"voice"`. */
20
+ export type ChannelKind = keyof typeof ChannelKinds;
21
+ /** A channel type Discord has no kind for yet. */
22
+ export type UnknownChannelKind = "unknown";
23
+ /** The kind of a Discord channel `type`, or `"unknown"` for a type this version does not know. */
24
+ export declare function channelKindOf(type: number): ChannelKind | UnknownChannelKind;
25
+ /** The Discord channel `type` numbers a kind covers (three for `"thread"`, one for the rest). */
26
+ export declare function channelTypesOf(kind: ChannelKind): readonly number[];
@@ -80,12 +80,15 @@ export declare const Intents: {
80
80
  readonly guildMessagePolls: number;
81
81
  readonly directMessagePolls: number;
82
82
  };
83
- /** Gateway intent resolvable value (single bitfield, enum key, or array of bitfields/strings). */
84
- export type GatewayIntentResolvable = number | keyof typeof GatewayIntentBits | keyof typeof IntentBits | (number | keyof typeof GatewayIntentBits | keyof typeof IntentBits | string)[] | {
85
- readonly bitfield: number;
86
- };
87
- /** Resolves any GatewayIntentResolvable into a raw bitfield integer. */
83
+ /** Gateway intents: an array of intent bits or names, e.g. `[GatewayIntentBits.Guilds, "GuildMessages"]`. A single number, name or OR-ed bitfield is not accepted. */
84
+ export type GatewayIntentResolvable = readonly (number | keyof typeof GatewayIntentBits | keyof typeof IntentBits | string)[];
85
+ /**
86
+ * Resolves an array of intents into a raw bitfield integer.
87
+ * @throws {TypeError} If `intents` is not an array (an OR-ed number, a single name or a bitfield object).
88
+ */
88
89
  export declare function resolveGatewayIntents(intents: GatewayIntentResolvable): number;
90
+ /** What `IntentsBitField` methods take: one intent or an array of them. Clients and gateways take only arrays. */
91
+ type IntentsInput = GatewayIntentResolvable[number] | GatewayIntentResolvable;
89
92
  /**
90
93
  * Discord.js-familiar intent bitfield.
91
94
  * @example new IntentsBitField([IntentsBitField.Flags.Guilds, "GuildMessages"])
@@ -117,19 +120,19 @@ export declare class IntentsBitField {
117
120
  };
118
121
  /** Raw intent bitfield. */
119
122
  bitfield: number;
120
- constructor(bits?: GatewayIntentResolvable);
123
+ constructor(bits?: IntentsInput);
121
124
  /** Whether every given intent is set. */
122
- has(bits: GatewayIntentResolvable): boolean;
125
+ has(bits: IntentsInput): boolean;
123
126
  /** Whether any given intent is set. */
124
- any(bits: GatewayIntentResolvable): boolean;
127
+ any(bits: IntentsInput): boolean;
125
128
  /** Adds intents in place. @returns This bitfield. */
126
- add(...bits: GatewayIntentResolvable[]): this;
129
+ add(...bits: IntentsInput[]): this;
127
130
  /** Removes intents in place. @returns This bitfield. */
128
- remove(...bits: GatewayIntentResolvable[]): this;
131
+ remove(...bits: IntentsInput[]): this;
129
132
  /** Names of the set intents. */
130
133
  toArray(): (keyof typeof GatewayIntentBits)[];
131
134
  /** Whether this equals another bitfield. */
132
- equals(bits: GatewayIntentResolvable): boolean;
135
+ equals(bits: IntentsInput): boolean;
133
136
  valueOf(): number;
134
137
  toJSON(): number;
135
138
  }
@@ -138,7 +141,7 @@ export interface GatewayProperties {
138
141
  os?: string;
139
142
  browser?: string;
140
143
  device?: string;
141
- [key: string]: unknown;
144
+ [key: string]: string | undefined;
142
145
  }
143
146
  /** Gateway presence activity. */
144
147
  export interface GatewayPresenceActivity {
@@ -159,6 +162,12 @@ export interface ClientOptions {
159
162
  token: string;
160
163
  intents: GatewayIntentResolvable;
161
164
  gateway?: GatewayOptions;
165
+ /**
166
+ * zlib-stream transport compression for the Gateway connection, about a
167
+ * tenth of the inbound bandwidth. Shorthand for `gateway: { compress }`,
168
+ * which wins when both are set. Off by default.
169
+ */
170
+ compress?: boolean;
162
171
  rest?: RESTOptions;
163
172
  /** Opt-in bounded per-channel message cache. Messages are not cached by default. */
164
173
  messageCache?: {
@@ -175,6 +184,8 @@ export interface ClientOptions {
175
184
  members?: boolean;
176
185
  roles?: boolean;
177
186
  emojis?: boolean;
187
+ /** Keep each member's latest presence (needs the `GuildPresences` intent). Off by default: it is a lot of data. */
188
+ presences?: boolean;
178
189
  };
179
190
  /**
180
191
  * Default `allowed_mentions` for every message the client sends (channel
@@ -209,3 +220,4 @@ export interface RESTOptions {
209
220
  retries?: number;
210
221
  baseURL?: string;
211
222
  }
223
+ export {};