lunibee 0.3.1 → 0.3.3

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 (81) hide show
  1. package/dist/builders/attachment.d.ts +1 -0
  2. package/dist/builders/clone.d.ts +10 -0
  3. package/dist/builders/commands.d.ts +1 -1
  4. package/dist/builders/components.d.ts +24 -5
  5. package/dist/builders/index.js +64 -17
  6. package/dist/builders/index.js.map +10 -9
  7. package/dist/collection/index.d.ts +1 -0
  8. package/dist/collection/index.js +297 -19
  9. package/dist/collection/index.js.map +5 -4
  10. package/dist/collection/redis.d.ts +98 -0
  11. package/dist/core/collector.d.ts +8 -0
  12. package/dist/core/events.d.ts +1 -0
  13. package/dist/core/index.d.ts +3 -0
  14. package/dist/core/index.js +6242 -4733
  15. package/dist/core/index.js.map +47 -40
  16. package/dist/core/permissions.d.ts +3 -402
  17. package/dist/core/redis-cache.d.ts +85 -0
  18. package/dist/formatters/index.d.ts +5 -1
  19. package/dist/formatters/index.js +7 -3
  20. package/dist/formatters/index.js.map +3 -3
  21. package/dist/handlers/index.js +11 -2
  22. package/dist/handlers/index.js.map +3 -3
  23. package/dist/index.js +8688 -6136
  24. package/dist/index.js.map +67 -59
  25. package/dist/managers/application.d.ts +10 -6
  26. package/dist/managers/base.d.ts +11 -1
  27. package/dist/managers/guild.d.ts +3 -1
  28. package/dist/managers/index.d.ts +6 -1
  29. package/dist/managers/index.js +383 -109
  30. package/dist/managers/index.js.map +20 -23
  31. package/dist/managers/member.d.ts +3 -1
  32. package/dist/managers/message.d.ts +13 -4
  33. package/dist/managers/thread.d.ts +3 -3
  34. package/dist/rest/decoder.d.ts +2 -0
  35. package/dist/rest/errors.d.ts +5 -2
  36. package/dist/rest/headers.d.ts +31 -0
  37. package/dist/rest/identity.d.ts +31 -0
  38. package/dist/rest/index.d.ts +97 -6
  39. package/dist/rest/index.js +1355 -220
  40. package/dist/rest/index.js.map +16 -13
  41. package/dist/rest/limiter.d.ts +75 -10
  42. package/dist/rest/redis.d.ts +103 -22
  43. package/dist/rest/scheduler.d.ts +13 -0
  44. package/dist/rest/store.d.ts +135 -12
  45. package/dist/rest/telemetry.d.ts +151 -0
  46. package/dist/rest/webhook.d.ts +18 -6
  47. package/dist/sharding/bus.d.ts +4 -2
  48. package/dist/sharding/cluster.d.ts +29 -1
  49. package/dist/sharding/health.d.ts +1 -1
  50. package/dist/sharding/host.d.ts +13 -2
  51. package/dist/sharding/identify.d.ts +2 -0
  52. package/dist/sharding/index.d.ts +8 -0
  53. package/dist/sharding/index.js +579 -65
  54. package/dist/sharding/index.js.map +17 -15
  55. package/dist/sharding/leader.d.ts +34 -0
  56. package/dist/sharding/remote.d.ts +36 -2
  57. package/dist/sharding/supervisor.d.ts +1 -1
  58. package/dist/sharding/thread.d.ts +30 -0
  59. package/dist/sharding/transport.d.ts +6 -5
  60. package/dist/sharding/worker.d.ts +11 -1
  61. package/dist/structures/base.d.ts +16 -5
  62. package/dist/structures/index.d.ts +1 -1
  63. package/dist/structures/index.js +57 -91
  64. package/dist/structures/index.js.map +10 -18
  65. package/dist/structures/options.d.ts +3 -2
  66. package/dist/structures/permissions.d.ts +409 -0
  67. package/dist/structures/resources.d.ts +4 -1
  68. package/dist/types/gateway.d.ts +4 -0
  69. package/dist/types/index.d.ts +14 -4
  70. package/dist/types/index.js.map +3 -3
  71. package/dist/utils/args.d.ts +3 -1
  72. package/dist/utils/index.d.ts +6 -1
  73. package/dist/utils/index.js +17 -10
  74. package/dist/utils/index.js.map +4 -4
  75. package/dist/voice/index.d.ts +7 -1
  76. package/dist/voice/index.js +33 -10
  77. package/dist/voice/index.js.map +3 -3
  78. package/dist/ws/index.d.ts +2 -0
  79. package/dist/ws/index.js +32 -4
  80. package/dist/ws/index.js.map +5 -5
  81. package/package.json +21 -17
@@ -1,3 +1,4 @@
1
+ import type { UserData } from "@lunibee/types";
1
2
  /** Raw Discord application command interaction data option. */
2
3
  export interface APIInteractionDataOption {
3
4
  name: string;
@@ -36,8 +37,8 @@ export declare class CommandOptions {
36
37
  getBoolean(name: string, required?: false): boolean | null;
37
38
  getBoolean(name: string, required: true): boolean;
38
39
  /** Gets the raw resolved user data for a user option. @param name Option name. @param required If true, throws when missing. */
39
- getUser(name: string, required?: false): Record<string, unknown> | null;
40
- getUser(name: string, required: true): Record<string, unknown>;
40
+ getUser(name: string, required?: false): (UserData & Record<string, unknown>) | null;
41
+ getUser(name: string, required: true): UserData & Record<string, unknown>;
41
42
  /** Gets the raw resolved channel data for a channel option. @param name Option name. @param required If true, throws when missing. */
42
43
  getChannel(name: string, required?: false): Record<string, unknown> | null;
43
44
  getChannel(name: string, required: true): Record<string, unknown>;
@@ -0,0 +1,409 @@
1
+ /** Permission overwrite target types. */
2
+ export declare enum PermissionOverwriteEnum {
3
+ Role = 0,
4
+ Member = 1
5
+ }
6
+ /** Lunibee idiomatic camelCase permission bitflags. */
7
+ export declare const Permission: {
8
+ readonly createInstantInvite: bigint;
9
+ readonly kickMembers: bigint;
10
+ readonly banMembers: bigint;
11
+ readonly administrator: bigint;
12
+ readonly manageChannels: bigint;
13
+ readonly manageGuild: bigint;
14
+ readonly addReactions: bigint;
15
+ readonly viewAuditLog: bigint;
16
+ readonly prioritySpeaker: bigint;
17
+ readonly stream: bigint;
18
+ readonly viewChannel: bigint;
19
+ readonly sendMessages: bigint;
20
+ readonly sendTTSMessages: bigint;
21
+ readonly manageMessages: bigint;
22
+ readonly embedLinks: bigint;
23
+ readonly attachFiles: bigint;
24
+ readonly readMessageHistory: bigint;
25
+ readonly mentionEveryone: bigint;
26
+ readonly useExternalEmojis: bigint;
27
+ readonly viewGuildInsights: bigint;
28
+ readonly connect: bigint;
29
+ readonly speak: bigint;
30
+ readonly muteMembers: bigint;
31
+ readonly deafenMembers: bigint;
32
+ readonly moveMembers: bigint;
33
+ readonly useVAD: bigint;
34
+ readonly changeNickname: bigint;
35
+ readonly manageNicknames: bigint;
36
+ readonly manageRoles: bigint;
37
+ readonly manageWebhooks: bigint;
38
+ readonly manageGuildExpressions: bigint;
39
+ readonly useApplicationCommands: bigint;
40
+ readonly requestToSpeak: bigint;
41
+ readonly manageEvents: bigint;
42
+ readonly manageThreads: bigint;
43
+ readonly createPublicThreads: bigint;
44
+ readonly createPrivateThreads: bigint;
45
+ readonly useExternalStickers: bigint;
46
+ readonly sendMessagesInThreads: bigint;
47
+ readonly useEmbeddedActivities: bigint;
48
+ readonly moderateMembers: bigint;
49
+ readonly viewCreatorMonetizationAnalytics: bigint;
50
+ readonly useSoundboard: bigint;
51
+ readonly createGuildExpressions: bigint;
52
+ readonly createEvents: bigint;
53
+ readonly useExternalSounds: bigint;
54
+ readonly sendVoiceMessages: bigint;
55
+ readonly setVoiceChannelStatus: bigint;
56
+ readonly sendPolls: bigint;
57
+ readonly useExternalApps: bigint;
58
+ readonly pinMessages: bigint;
59
+ readonly bypassSlowmode: bigint;
60
+ };
61
+ /** Canonical PascalCase permission constants. */
62
+ export declare const Permissions: {
63
+ readonly CreateInstantInvite: bigint;
64
+ readonly KickMembers: bigint;
65
+ readonly BanMembers: bigint;
66
+ readonly Administrator: bigint;
67
+ readonly ManageChannels: bigint;
68
+ readonly ManageGuild: bigint;
69
+ readonly AddReactions: bigint;
70
+ readonly ViewAuditLog: bigint;
71
+ readonly PrioritySpeaker: bigint;
72
+ readonly Stream: bigint;
73
+ readonly ViewChannel: bigint;
74
+ readonly SendMessages: bigint;
75
+ readonly SendTTSMessages: bigint;
76
+ readonly ManageMessages: bigint;
77
+ readonly EmbedLinks: bigint;
78
+ readonly AttachFiles: bigint;
79
+ readonly ReadMessageHistory: bigint;
80
+ readonly MentionEveryone: bigint;
81
+ readonly UseExternalEmojis: bigint;
82
+ readonly ViewGuildInsights: bigint;
83
+ readonly Connect: bigint;
84
+ readonly Speak: bigint;
85
+ readonly MuteMembers: bigint;
86
+ readonly DeafenMembers: bigint;
87
+ readonly MoveMembers: bigint;
88
+ readonly UseVAD: bigint;
89
+ readonly ChangeNickname: bigint;
90
+ readonly ManageNicknames: bigint;
91
+ readonly ManageRoles: bigint;
92
+ readonly ManageWebhooks: bigint;
93
+ readonly ManageGuildExpressions: bigint;
94
+ readonly UseApplicationCommands: bigint;
95
+ readonly RequestToSpeak: bigint;
96
+ readonly ManageEvents: bigint;
97
+ readonly ManageThreads: bigint;
98
+ readonly CreatePublicThreads: bigint;
99
+ readonly CreatePrivateThreads: bigint;
100
+ readonly UseExternalStickers: bigint;
101
+ readonly SendMessagesInThreads: bigint;
102
+ readonly UseEmbeddedActivities: bigint;
103
+ readonly ModerateMembers: bigint;
104
+ readonly ViewCreatorMonetizationAnalytics: bigint;
105
+ readonly UseSoundboard: bigint;
106
+ readonly CreateGuildExpressions: bigint;
107
+ readonly CreateEvents: bigint;
108
+ readonly UseExternalSounds: bigint;
109
+ readonly SendVoiceMessages: bigint;
110
+ readonly SetVoiceChannelStatus: bigint;
111
+ readonly SendPolls: bigint;
112
+ readonly UseExternalApps: bigint;
113
+ readonly PinMessages: bigint;
114
+ readonly BypassSlowmode: bigint;
115
+ };
116
+ /**
117
+ * Permission flag bits with **bigint** values matching Discord's permission bit
118
+ * positions. Mirrors discord.js's `PermissionFlagsBits`, so bitwise composition
119
+ * (`Flags.A | Flags.B`) OR-s the bits instead of concatenating strings.
120
+ *
121
+ * The same object as {@link Permissions}, under the discord.js name. It is a
122
+ * `const` object rather than a TS `enum` because enums cannot hold bigint
123
+ * members; the same-named union type below preserves usage as a type.
124
+ */
125
+ export declare const PermissionFlagsBits: {
126
+ readonly CreateInstantInvite: bigint;
127
+ readonly KickMembers: bigint;
128
+ readonly BanMembers: bigint;
129
+ readonly Administrator: bigint;
130
+ readonly ManageChannels: bigint;
131
+ readonly ManageGuild: bigint;
132
+ readonly AddReactions: bigint;
133
+ readonly ViewAuditLog: bigint;
134
+ readonly PrioritySpeaker: bigint;
135
+ readonly Stream: bigint;
136
+ readonly ViewChannel: bigint;
137
+ readonly SendMessages: bigint;
138
+ readonly SendTTSMessages: bigint;
139
+ readonly ManageMessages: bigint;
140
+ readonly EmbedLinks: bigint;
141
+ readonly AttachFiles: bigint;
142
+ readonly ReadMessageHistory: bigint;
143
+ readonly MentionEveryone: bigint;
144
+ readonly UseExternalEmojis: bigint;
145
+ readonly ViewGuildInsights: bigint;
146
+ readonly Connect: bigint;
147
+ readonly Speak: bigint;
148
+ readonly MuteMembers: bigint;
149
+ readonly DeafenMembers: bigint;
150
+ readonly MoveMembers: bigint;
151
+ readonly UseVAD: bigint;
152
+ readonly ChangeNickname: bigint;
153
+ readonly ManageNicknames: bigint;
154
+ readonly ManageRoles: bigint;
155
+ readonly ManageWebhooks: bigint;
156
+ readonly ManageGuildExpressions: bigint;
157
+ readonly UseApplicationCommands: bigint;
158
+ readonly RequestToSpeak: bigint;
159
+ readonly ManageEvents: bigint;
160
+ readonly ManageThreads: bigint;
161
+ readonly CreatePublicThreads: bigint;
162
+ readonly CreatePrivateThreads: bigint;
163
+ readonly UseExternalStickers: bigint;
164
+ readonly SendMessagesInThreads: bigint;
165
+ readonly UseEmbeddedActivities: bigint;
166
+ readonly ModerateMembers: bigint;
167
+ readonly ViewCreatorMonetizationAnalytics: bigint;
168
+ readonly UseSoundboard: bigint;
169
+ readonly CreateGuildExpressions: bigint;
170
+ readonly CreateEvents: bigint;
171
+ readonly UseExternalSounds: bigint;
172
+ readonly SendVoiceMessages: bigint;
173
+ readonly SetVoiceChannelStatus: bigint;
174
+ readonly SendPolls: bigint;
175
+ readonly UseExternalApps: bigint;
176
+ readonly PinMessages: bigint;
177
+ readonly BypassSlowmode: bigint;
178
+ };
179
+ /** Union of {@link PermissionFlagsBits} values (all bigint). */
180
+ export type PermissionFlagsBits = (typeof PermissionFlagsBits)[keyof typeof PermissionFlagsBits];
181
+ /** A permission flag name, such as `"BanMembers"`, accepted wherever a permission can be given by name. */
182
+ export type PermissionName = keyof typeof Permission | keyof typeof Permissions | keyof typeof PermissionFlagsBits;
183
+ /** Anything accepted as permissions: a bit, a name, a `PermissionSet`, or an array of these. */
184
+ export type PermissionResolvable = bigint | number | string | PermissionName | PermissionFlagsBits | PermissionSet | PermissionResolvable[];
185
+ /** Immutable permission bitfield with direct boolean getters. */
186
+ export declare class PermissionSet {
187
+ #private;
188
+ /** Permission bitfield. */
189
+ readonly bitfield: bigint;
190
+ /** Creates a permission set. @param value Initial permission bitfield or array of permissions. @throws {RangeError} If the value is negative. @throws {TypeError} If the value is not a valid integer. */
191
+ constructor(value?: PermissionResolvable);
192
+ get createInstantInvite(): boolean;
193
+ get kickMembers(): boolean;
194
+ get banMembers(): boolean;
195
+ get administrator(): boolean;
196
+ get manageChannels(): boolean;
197
+ get manageGuild(): boolean;
198
+ get addReactions(): boolean;
199
+ get viewAuditLog(): boolean;
200
+ get prioritySpeaker(): boolean;
201
+ get stream(): boolean;
202
+ get viewChannel(): boolean;
203
+ get sendMessages(): boolean;
204
+ get sendTTSMessages(): boolean;
205
+ get manageMessages(): boolean;
206
+ get embedLinks(): boolean;
207
+ get attachFiles(): boolean;
208
+ get readMessageHistory(): boolean;
209
+ get mentionEveryone(): boolean;
210
+ get useExternalEmojis(): boolean;
211
+ get viewGuildInsights(): boolean;
212
+ get connect(): boolean;
213
+ get speak(): boolean;
214
+ get muteMembers(): boolean;
215
+ get deafenMembers(): boolean;
216
+ get moveMembers(): boolean;
217
+ get useVAD(): boolean;
218
+ get changeNickname(): boolean;
219
+ get manageNicknames(): boolean;
220
+ get manageRoles(): boolean;
221
+ get manageWebhooks(): boolean;
222
+ get manageGuildExpressions(): boolean;
223
+ get useApplicationCommands(): boolean;
224
+ get requestToSpeak(): boolean;
225
+ get manageEvents(): boolean;
226
+ get manageThreads(): boolean;
227
+ get createPublicThreads(): boolean;
228
+ get createPrivateThreads(): boolean;
229
+ get useExternalStickers(): boolean;
230
+ get sendMessagesInThreads(): boolean;
231
+ get useEmbeddedActivities(): boolean;
232
+ get moderateMembers(): boolean;
233
+ get viewCreatorMonetizationAnalytics(): boolean;
234
+ get useSoundboard(): boolean;
235
+ get createGuildExpressions(): boolean;
236
+ get createEvents(): boolean;
237
+ get useExternalSounds(): boolean;
238
+ get sendVoiceMessages(): boolean;
239
+ get sendPolls(): boolean;
240
+ get useExternalApps(): boolean;
241
+ get setVoiceChannelStatus(): boolean;
242
+ get pinMessages(): boolean;
243
+ get bypassSlowmode(): boolean;
244
+ /** Checks whether all supplied permissions are present (AND). @param permissions Permission names or raw bits. @returns True when every requested permission is present. */
245
+ has(...permissions: PermissionResolvable[]): boolean;
246
+ /** Checks whether any supplied permission is present (OR). @param permissions Permission names or raw bits. @returns True when at least one requested permission is present. */
247
+ any(...permissions: PermissionResolvable[]): boolean;
248
+ /** Returns the known permission names from `permissions` that this set lacks. @param permissions Permission names or raw bits. */
249
+ missing(...permissions: PermissionResolvable[]): PermissionName[];
250
+ /** Returns a new set with permissions added. @param permissions Permission names or raw bits. @returns A new permission set. */
251
+ add(...permissions: PermissionResolvable[]): PermissionSet;
252
+ /** Returns a new set with permissions removed. @param permissions Permission names or raw bits. @returns A new permission set. */
253
+ remove(...permissions: PermissionResolvable[]): PermissionSet;
254
+ /** Checks equality with another permission set or raw bitfield. @param other Permission set or raw bitfield. @returns True when both values are equal. */
255
+ equals(other: PermissionSet | bigint | number | string): boolean;
256
+ /** Returns the decimal permission representation. @returns Decimal permission bitfield. */
257
+ toString(): string;
258
+ /** Returns known permission names contained in this set. @returns Names of all enabled known permissions. */
259
+ toArray(): PermissionName[];
260
+ }
261
+ /** Permissions bitfield alias. */
262
+ export declare class PermissionsBitField extends PermissionSet {
263
+ /** Permission flags bits enum. */
264
+ static readonly Flags: {
265
+ readonly CreateInstantInvite: bigint;
266
+ readonly KickMembers: bigint;
267
+ readonly BanMembers: bigint;
268
+ readonly Administrator: bigint;
269
+ readonly ManageChannels: bigint;
270
+ readonly ManageGuild: bigint;
271
+ readonly AddReactions: bigint;
272
+ readonly ViewAuditLog: bigint;
273
+ readonly PrioritySpeaker: bigint;
274
+ readonly Stream: bigint;
275
+ readonly ViewChannel: bigint;
276
+ readonly SendMessages: bigint;
277
+ readonly SendTTSMessages: bigint;
278
+ readonly ManageMessages: bigint;
279
+ readonly EmbedLinks: bigint;
280
+ readonly AttachFiles: bigint;
281
+ readonly ReadMessageHistory: bigint;
282
+ readonly MentionEveryone: bigint;
283
+ readonly UseExternalEmojis: bigint;
284
+ readonly ViewGuildInsights: bigint;
285
+ readonly Connect: bigint;
286
+ readonly Speak: bigint;
287
+ readonly MuteMembers: bigint;
288
+ readonly DeafenMembers: bigint;
289
+ readonly MoveMembers: bigint;
290
+ readonly UseVAD: bigint;
291
+ readonly ChangeNickname: bigint;
292
+ readonly ManageNicknames: bigint;
293
+ readonly ManageRoles: bigint;
294
+ readonly ManageWebhooks: bigint;
295
+ readonly ManageGuildExpressions: bigint;
296
+ readonly UseApplicationCommands: bigint;
297
+ readonly RequestToSpeak: bigint;
298
+ readonly ManageEvents: bigint;
299
+ readonly ManageThreads: bigint;
300
+ readonly CreatePublicThreads: bigint;
301
+ readonly CreatePrivateThreads: bigint;
302
+ readonly UseExternalStickers: bigint;
303
+ readonly SendMessagesInThreads: bigint;
304
+ readonly UseEmbeddedActivities: bigint;
305
+ readonly ModerateMembers: bigint;
306
+ readonly ViewCreatorMonetizationAnalytics: bigint;
307
+ readonly UseSoundboard: bigint;
308
+ readonly CreateGuildExpressions: bigint;
309
+ readonly CreateEvents: bigint;
310
+ readonly UseExternalSounds: bigint;
311
+ readonly SendVoiceMessages: bigint;
312
+ readonly SetVoiceChannelStatus: bigint;
313
+ readonly SendPolls: bigint;
314
+ readonly UseExternalApps: bigint;
315
+ readonly PinMessages: bigint;
316
+ readonly BypassSlowmode: bigint;
317
+ };
318
+ /** Permission flags constants. */
319
+ static readonly All: {
320
+ readonly createInstantInvite: bigint;
321
+ readonly kickMembers: bigint;
322
+ readonly banMembers: bigint;
323
+ readonly administrator: bigint;
324
+ readonly manageChannels: bigint;
325
+ readonly manageGuild: bigint;
326
+ readonly addReactions: bigint;
327
+ readonly viewAuditLog: bigint;
328
+ readonly prioritySpeaker: bigint;
329
+ readonly stream: bigint;
330
+ readonly viewChannel: bigint;
331
+ readonly sendMessages: bigint;
332
+ readonly sendTTSMessages: bigint;
333
+ readonly manageMessages: bigint;
334
+ readonly embedLinks: bigint;
335
+ readonly attachFiles: bigint;
336
+ readonly readMessageHistory: bigint;
337
+ readonly mentionEveryone: bigint;
338
+ readonly useExternalEmojis: bigint;
339
+ readonly viewGuildInsights: bigint;
340
+ readonly connect: bigint;
341
+ readonly speak: bigint;
342
+ readonly muteMembers: bigint;
343
+ readonly deafenMembers: bigint;
344
+ readonly moveMembers: bigint;
345
+ readonly useVAD: bigint;
346
+ readonly changeNickname: bigint;
347
+ readonly manageNicknames: bigint;
348
+ readonly manageRoles: bigint;
349
+ readonly manageWebhooks: bigint;
350
+ readonly manageGuildExpressions: bigint;
351
+ readonly useApplicationCommands: bigint;
352
+ readonly requestToSpeak: bigint;
353
+ readonly manageEvents: bigint;
354
+ readonly manageThreads: bigint;
355
+ readonly createPublicThreads: bigint;
356
+ readonly createPrivateThreads: bigint;
357
+ readonly useExternalStickers: bigint;
358
+ readonly sendMessagesInThreads: bigint;
359
+ readonly useEmbeddedActivities: bigint;
360
+ readonly moderateMembers: bigint;
361
+ readonly viewCreatorMonetizationAnalytics: bigint;
362
+ readonly useSoundboard: bigint;
363
+ readonly createGuildExpressions: bigint;
364
+ readonly createEvents: bigint;
365
+ readonly useExternalSounds: bigint;
366
+ readonly sendVoiceMessages: bigint;
367
+ readonly setVoiceChannelStatus: bigint;
368
+ readonly sendPolls: bigint;
369
+ readonly useExternalApps: bigint;
370
+ readonly pinMessages: bigint;
371
+ readonly bypassSlowmode: bigint;
372
+ };
373
+ /** Creates a permissions bitfield. @param value Initial permission bitfield or array of permissions. */
374
+ constructor(value?: PermissionResolvable);
375
+ }
376
+ /** A role as needed for permission resolution. */
377
+ export interface PermissionRole {
378
+ id: string;
379
+ permissions: PermissionResolvable;
380
+ }
381
+ /** A channel permission overwrite (Discord's `permission_overwrites` entry). */
382
+ export interface PermissionOverwrite {
383
+ id: string;
384
+ type: PermissionOverwriteEnum | number;
385
+ allow: PermissionResolvable;
386
+ deny: PermissionResolvable;
387
+ }
388
+ /** Everything needed to resolve a member's permissions. */
389
+ export interface PermissionContext {
390
+ guildId: string;
391
+ /** Guild owner ID; the owner has every permission. */
392
+ ownerId?: string;
393
+ memberId: string;
394
+ memberRoleIds: readonly string[];
395
+ /** Guild roles, including `@everyone` (whose ID is the guild ID). */
396
+ roles: readonly PermissionRole[];
397
+ /** Channel overwrites; omit for guild-level permissions. */
398
+ overwrites?: readonly PermissionOverwrite[];
399
+ /** When the member's timeout ends; while it is in the future the member keeps only View Channel and Read Message History. */
400
+ timedOutUntil?: Date | number | null;
401
+ }
402
+ /**
403
+ * Resolves a member's effective permissions the way Discord does: base
404
+ * permissions from `@everyone` and the member's roles (owner and
405
+ * administrator get everything), then the channel's `@everyone` overwrite,
406
+ * the combined role overwrites, and finally the member overwrite. A member
407
+ * whose timeout has not ended keeps only View Channel and Read Message History.
408
+ */
409
+ export declare function computePermissions(context: PermissionContext): PermissionSet;
@@ -1,5 +1,5 @@
1
1
  import { BaseStructure, Channel, User } from "./base.js";
2
- import { PermissionsBitField } from "@lunibee/core";
2
+ import { PermissionsBitField } from "./permissions.js";
3
3
  import type { ImageURLOptions, ResourceContext } from "./base.js";
4
4
  /** A Discord guild member. */
5
5
  export declare class GuildMember {
@@ -52,6 +52,9 @@ export declare class GuildMember {
52
52
  * resolved for the channel); anywhere else they are computed at guild
53
53
  * level from the cached roles each time they are read, so they follow role
54
54
  * changes. Empty when the guild's roles are not cached.
55
+ *
56
+ * Interaction permissions are used as Discord sent them: Discord computes
57
+ * them, so the local timeout mask is not applied on top.
55
58
  */
56
59
  get permissions(): PermissionsBitField;
57
60
  /** The member's permissions in a channel, with its overwrites. Null when the channel or guild is not cached. @param channelId Channel ID. */
@@ -186,6 +186,8 @@ export interface ClientOptions {
186
186
  emojis?: boolean;
187
187
  /** Keep each member's latest presence (needs the `GuildPresences` intent). Off by default: it is a lot of data. */
188
188
  presences?: boolean;
189
+ /** Most members kept per guild (least recently used leave first). Default: unbounded, so a big guild's member list stays whole. */
190
+ maxMembers?: number;
189
191
  };
190
192
  /**
191
193
  * Default `allowed_mentions` for every message the client sends (channel
@@ -205,6 +207,8 @@ export interface AllowedMentions {
205
207
  /** Gateway connection configuration. */
206
208
  export interface GatewayOptions {
207
209
  intents?: GatewayIntentResolvable;
210
+ /** zlib-stream transport compression; `ClientOptions.compress` is shorthand for this. */
211
+ compress?: boolean;
208
212
  reconnect?: boolean;
209
213
  maxReconnectAttempts?: number;
210
214
  reconnectBaseDelay?: number;
@@ -281,6 +281,14 @@ export interface MessageFile {
281
281
  name: string;
282
282
  data: Blob | Uint8Array | ArrayBuffer | string;
283
283
  contentType?: string;
284
+ /** Alt text, sent as the attachment's `description`. */
285
+ description?: string;
286
+ }
287
+ /** A file whose bytes are read when the message is sent, such as a `CreateAttachment`. */
288
+ export interface MessageFileSource {
289
+ name: string;
290
+ description?: string;
291
+ toBuffer(): Promise<Uint8Array>;
284
292
  }
285
293
  /** A poll to send; Discord fills in `results` and `expiry` when it is read back. */
286
294
  export interface MessagePoll {
@@ -302,7 +310,7 @@ export interface MessagePoll {
302
310
  /** What `send()` takes. */
303
311
  export interface MessageCreateOptions extends MessagePayload {
304
312
  /** Files to upload; the message is sent as multipart. */
305
- files?: MessageFile[];
313
+ files?: (MessageFile | MessageFileSource)[];
306
314
  /** Reply to or forward another message. */
307
315
  message_reference?: APIMessageReference;
308
316
  poll?: MessagePoll;
@@ -313,13 +321,13 @@ export interface MessageCreateOptions extends MessagePayload {
313
321
  }
314
322
  /** What `edit()` takes: the fields Discord lets you change after sending. */
315
323
  export interface MessageEditOptions extends MessagePayload {
316
- files?: MessageFile[];
324
+ files?: (MessageFile | MessageFileSource)[];
317
325
  }
318
326
  /** What a reply, edit-reply, follow-up or update to an interaction takes. */
319
327
  export interface InteractionReplyOptions extends MessagePayload {
320
328
  /** Only the person who ran the command sees it. */
321
329
  ephemeral?: boolean;
322
- files?: MessageFile[];
330
+ files?: (MessageFile | MessageFileSource)[];
323
331
  poll?: MessagePoll;
324
332
  /** On `reply()` / `update()`: return the created message (one request, no `fetchReply()`). */
325
333
  withResponse?: boolean;
@@ -721,6 +729,7 @@ export declare const ActivityEnum: {
721
729
  };
722
730
  /** One {@link ActivityEnum} value, usable as a type. */
723
731
  export type ActivityEnum = (typeof ActivityEnum)[keyof typeof ActivityEnum];
732
+ /** An activity in a presence (playing, streaming, listening, a custom status…). */
724
733
  export interface APIActivity {
725
734
  name: string;
726
735
  type: number;
@@ -987,7 +996,8 @@ export interface APIApplicationCommand {
987
996
  /** Data for creating/overwriting an application command. */
988
997
  export interface ApplicationCommandData {
989
998
  name: string;
990
- description: string;
999
+ /** Required for slash commands; user and message context-menu commands have none. */
1000
+ description?: string;
991
1001
  type?: number;
992
1002
  options?: APIApplicationCommandOption[];
993
1003
  default_member_permissions?: string | null;