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
@@ -29,7 +29,7 @@ export interface ResourceContext {
29
29
  * (with overwrites) when a channel ID is given. Null when the guild (or
30
30
  * channel) is not cached.
31
31
  */
32
- memberPermissions?(guildId: string, memberId: string, roleIds: readonly string[], channelId?: string): import("@lunibee/core").PermissionSet | null;
32
+ memberPermissions?(guildId: string, memberId: string, roleIds: readonly string[], channelId?: string, timedOutUntil?: Date | null): import("@lunibee/core").PermissionSet | null;
33
33
  kickMember?(guildId: string, userId: string, reason?: string): Promise<void>;
34
34
  banMember?(guildId: string, userId: string, options?: {
35
35
  reason?: string;
@@ -170,15 +170,24 @@ export declare class Guild extends BaseStructure {
170
170
  explicitContentFilter: number;
171
171
  /** Default notification level for new members. */
172
172
  defaultMessageNotifications: number;
173
- /** AFK voice channel, or null. */ afkChannelId: string | null;
174
- /** Seconds before a silent member is moved to the AFK channel. */ afkTimeout?: number;
175
- /** Whether the server widget is on. */ widgetEnabled: boolean;
176
- /** Channel the widget invites to, or null. */ widgetChannelId: string | null;
177
- /** Application that created the guild, if a bot did. */ applicationId: string | null;
178
- /** Channel for Discord's community updates, or null. */ publicUpdatesChannelId: string | null;
179
- /** Channel for safety alerts, or null. */ safetyAlertsChannelId: string | null;
180
- /** Maximum presences (null for the default limit). */ maxPresences: number | null;
181
- /** Maximum users in a video channel. */ maxVideoChannelUsers?: number;
173
+ /** AFK voice channel, or null. */
174
+ afkChannelId: string | null;
175
+ /** Seconds before a silent member is moved to the AFK channel. */
176
+ afkTimeout?: number;
177
+ /** Whether the server widget is on. */
178
+ widgetEnabled: boolean;
179
+ /** Channel the widget invites to, or null. */
180
+ widgetChannelId: string | null;
181
+ /** Application that created the guild, if a bot did. */
182
+ applicationId: string | null;
183
+ /** Channel for Discord's community updates, or null. */
184
+ publicUpdatesChannelId: string | null;
185
+ /** Channel for safety alerts, or null. */
186
+ safetyAlertsChannelId: string | null;
187
+ /** Maximum presences (null for the default limit). */
188
+ maxPresences: number | null;
189
+ /** Maximum users in a video channel. */
190
+ maxVideoChannelUsers?: number;
182
191
  constructor(data: import("@lunibee/types").APIGuild);
183
192
  /** Returns the guild icon URL, or null if no icon is set. */
184
193
  iconURL(options?: ImageURLOptions): string | null;
@@ -6,16 +6,22 @@ export declare class NewsChannel extends TextChannel {
6
6
  }
7
7
  /** A direct-message or group DM channel. */
8
8
  export declare class DMChannel extends Channel {
9
- /** Users in the conversation. */ readonly recipients: User[];
10
- /** Owner of a group DM. */ readonly ownerId: string | null;
9
+ /** Users in the conversation. */
10
+ readonly recipients: User[];
11
+ /** Owner of a group DM. */
12
+ readonly ownerId: string | null;
11
13
  constructor(data: APIChannel, context?: ResourceContext);
12
14
  }
13
15
  /** A guild voice channel. */
14
16
  export declare class VoiceChannel extends Channel {
15
- /** Bitrate in bits per second. */ bitrate: number;
16
- /** User limit (0 = unlimited). */ userLimit: number;
17
- /** Voice region override, or null for automatic. */ rtcRegion: string | null;
18
- /** Camera video quality mode. */ videoQualityMode: number;
17
+ /** Bitrate in bits per second. */
18
+ bitrate: number;
19
+ /** User limit (0 = unlimited). */
20
+ userLimit: number;
21
+ /** Voice region override, or null for automatic. */
22
+ rtcRegion: string | null;
23
+ /** Camera video quality mode. */
24
+ videoQualityMode: number;
19
25
  constructor(data: APIChannel, context?: ResourceContext);
20
26
  }
21
27
  /** A guild stage channel. */
@@ -26,10 +32,14 @@ export declare class CategoryChannel extends Channel {
26
32
  }
27
33
  /** A thread (announcement, public or private). */
28
34
  export declare class ThreadChannel extends Channel {
29
- /** User who created the thread. */ readonly ownerId: string | null;
30
- /** Approximate message count. */ messageCount: number;
31
- /** Approximate member count (stops counting at 50). */ memberCount: number;
32
- /** Thread metadata. */ metadata: APIThreadMetadata | null;
35
+ /** User who created the thread. */
36
+ readonly ownerId: string | null;
37
+ /** Approximate message count. */
38
+ messageCount: number;
39
+ /** Approximate member count (stops counting at 50). */
40
+ memberCount: number;
41
+ /** Thread metadata. */
42
+ metadata: APIThreadMetadata | null;
33
43
  constructor(data: APIChannel, context?: ResourceContext);
34
44
  /** Whether the thread is archived. */
35
45
  get archived(): boolean;
@@ -40,10 +50,14 @@ export declare class ThreadChannel extends Channel {
40
50
  }
41
51
  /** A guild forum channel. */
42
52
  export declare class ForumChannel extends Channel {
43
- /** Tags that threads can apply. */ availableTags: APIForumTag[];
44
- /** Default reaction for new threads. */ defaultReactionEmoji: APIPartialEmoji | null;
45
- /** Default slowmode for new threads. */ defaultThreadRateLimitPerUser: number;
46
- /** Default auto-archive duration for new threads. */ defaultAutoArchiveDuration: number | null;
53
+ /** Tags that threads can apply. */
54
+ availableTags: APIForumTag[];
55
+ /** Default reaction for new threads. */
56
+ defaultReactionEmoji: APIPartialEmoji | null;
57
+ /** Default slowmode for new threads. */
58
+ defaultThreadRateLimitPerUser: number;
59
+ /** Default auto-archive duration for new threads. */
60
+ defaultAutoArchiveDuration: number | null;
47
61
  constructor(data: APIChannel, context?: ResourceContext);
48
62
  }
49
63
  /** A guild media channel. */
@@ -19,7 +19,7 @@ function cdnURL(path, hash, options = {}) {
19
19
  const isAnimated = hash.startsWith("a_") && !options.forceStatic;
20
20
  const ext = options.extension ?? (isAnimated ? "gif" : "png");
21
21
  const size = options.size ? `?size=${options.size}` : "";
22
- return `${CDN_BASE}${path}/${hash}.${ext}${size}`;
22
+ return `${CDN_BASE}${path}/${encodeURIComponent(hash)}.${ext}${size}`;
23
23
  }
24
24
 
25
25
  class User extends BaseStructure {
@@ -375,60 +375,7 @@ var Permissions = {
375
375
  PinMessages: 1n << 51n,
376
376
  BypassSlowmode: 1n << 52n
377
377
  };
378
- var PermissionFlagsBits = {
379
- CreateInstantInvite: 1n << 0n,
380
- KickMembers: 1n << 1n,
381
- BanMembers: 1n << 2n,
382
- Administrator: 1n << 3n,
383
- ManageChannels: 1n << 4n,
384
- ManageGuild: 1n << 5n,
385
- AddReactions: 1n << 6n,
386
- ViewAuditLog: 1n << 7n,
387
- PrioritySpeaker: 1n << 8n,
388
- Stream: 1n << 9n,
389
- ViewChannel: 1n << 10n,
390
- SendMessages: 1n << 11n,
391
- SendTTSMessages: 1n << 12n,
392
- ManageMessages: 1n << 13n,
393
- EmbedLinks: 1n << 14n,
394
- AttachFiles: 1n << 15n,
395
- ReadMessageHistory: 1n << 16n,
396
- MentionEveryone: 1n << 17n,
397
- UseExternalEmojis: 1n << 18n,
398
- ViewGuildInsights: 1n << 19n,
399
- Connect: 1n << 20n,
400
- Speak: 1n << 21n,
401
- MuteMembers: 1n << 22n,
402
- DeafenMembers: 1n << 23n,
403
- MoveMembers: 1n << 24n,
404
- UseVAD: 1n << 25n,
405
- ChangeNickname: 1n << 26n,
406
- ManageNicknames: 1n << 27n,
407
- ManageRoles: 1n << 28n,
408
- ManageWebhooks: 1n << 29n,
409
- ManageGuildExpressions: 1n << 30n,
410
- UseApplicationCommands: 1n << 31n,
411
- RequestToSpeak: 1n << 32n,
412
- ManageEvents: 1n << 33n,
413
- ManageThreads: 1n << 34n,
414
- CreatePublicThreads: 1n << 35n,
415
- CreatePrivateThreads: 1n << 36n,
416
- UseExternalStickers: 1n << 37n,
417
- SendMessagesInThreads: 1n << 38n,
418
- UseEmbeddedActivities: 1n << 39n,
419
- ModerateMembers: 1n << 40n,
420
- ViewCreatorMonetizationAnalytics: 1n << 41n,
421
- UseSoundboard: 1n << 42n,
422
- CreateGuildExpressions: 1n << 43n,
423
- CreateEvents: 1n << 44n,
424
- UseExternalSounds: 1n << 45n,
425
- SendVoiceMessages: 1n << 46n,
426
- SetVoiceChannelStatus: 1n << 48n,
427
- SendPolls: 1n << 49n,
428
- UseExternalApps: 1n << 50n,
429
- PinMessages: 1n << 51n,
430
- BypassSlowmode: 1n << 52n
431
- };
378
+ var PermissionFlagsBits = Permissions;
432
379
 
433
380
  class PermissionSet {
434
381
  bitfield;
@@ -766,10 +713,13 @@ var InteractionResponseEnum = {
766
713
  Modal: 9
767
714
  };
768
715
  var InteractionResponseType = InteractionResponseEnum;
716
+ // packages/collection/src/index.ts
717
+ var mapGet = Map.prototype.get;
718
+ var mapHas = Map.prototype.has;
769
719
  // packages/rest/package.json
770
720
  var package_default = {
771
721
  name: "@lunibee/rest",
772
- version: "0.2.3",
722
+ version: "0.2.4",
773
723
  type: "module",
774
724
  module: "./src/index.ts",
775
725
  types: "./src/index.ts",
@@ -871,10 +821,10 @@ class GuildMember {
871
821
  get permissions() {
872
822
  if (this.#suppliedPermissions)
873
823
  return this.#suppliedPermissions;
874
- return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds) ?? 0n);
824
+ return new PermissionsBitField(this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, undefined, this.timedOutUntil) ?? 0n);
875
825
  }
876
826
  permissionsIn(channelId) {
877
- const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId);
827
+ const computed = this.#context?.memberPermissions?.(this.guildId, this.user.id, this.roleIds, channelId, this.timedOutUntil);
878
828
  return computed ? new PermissionsBitField(computed) : null;
879
829
  }
880
830
  #action(name) {
@@ -2269,4 +2219,4 @@ export {
2269
2219
  createInteraction
2270
2220
  };
2271
2221
 
2272
- //# debugId=07D330C2B35D9E3E64756E2164756E21
2222
+ //# debugId=6D582A31B8A2B2AE64756E2164756E21