lunibee 0.3.3 → 0.4.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 (125) hide show
  1. package/README.md +1 -1
  2. package/dist/builders/commands.d.ts +1 -1
  3. package/dist/builders/components.d.ts +9 -11
  4. package/dist/builders/embed.d.ts +1 -1
  5. package/dist/builders/index.d.ts +1 -1
  6. package/dist/builders/index.js +87 -1298
  7. package/dist/builders/index.js.map +3 -11
  8. package/dist/chunks/index-0wn81eng.js +2492 -0
  9. package/dist/chunks/index-0wn81eng.js.map +17 -0
  10. package/dist/chunks/index-2en489j6.js +40 -0
  11. package/dist/chunks/index-2en489j6.js.map +10 -0
  12. package/dist/chunks/index-3hyps48a.js +203 -0
  13. package/dist/chunks/index-3hyps48a.js.map +11 -0
  14. package/dist/chunks/index-57c5n3ms.js +2274 -0
  15. package/dist/chunks/index-57c5n3ms.js.map +19 -0
  16. package/dist/chunks/index-5yx92e36.js +1170 -0
  17. package/dist/chunks/index-5yx92e36.js.map +14 -0
  18. package/dist/chunks/index-690bp093.js +95 -0
  19. package/dist/chunks/index-690bp093.js.map +10 -0
  20. package/dist/chunks/index-7fp2hvmg.js +2155 -0
  21. package/dist/chunks/index-7fp2hvmg.js.map +24 -0
  22. package/dist/chunks/index-cnmsajvk.js +1119 -0
  23. package/dist/chunks/index-cnmsajvk.js.map +12 -0
  24. package/dist/chunks/index-fdvgk2sw.js +1310 -0
  25. package/dist/chunks/index-fdvgk2sw.js.map +21 -0
  26. package/dist/chunks/index-gyvps8b9.js +214 -0
  27. package/dist/chunks/index-gyvps8b9.js.map +12 -0
  28. package/dist/chunks/index-jzg4bh99.js +1533 -0
  29. package/dist/chunks/index-jzg4bh99.js.map +21 -0
  30. package/dist/chunks/index-mgw2yvrm.js +3547 -0
  31. package/dist/chunks/index-mgw2yvrm.js.map +25 -0
  32. package/dist/chunks/index-yh76b55h.js +3449 -0
  33. package/dist/chunks/index-yh76b55h.js.map +29 -0
  34. package/dist/collection/index.js +9 -1118
  35. package/dist/collection/index.js.map +3 -6
  36. package/dist/core/api.d.ts +3 -3
  37. package/dist/core/channel-create.d.ts +2 -2
  38. package/dist/core/commands.d.ts +3 -3
  39. package/dist/core/events.d.ts +4 -4
  40. package/dist/core/handles.d.ts +4 -4
  41. package/dist/core/index.d.ts +25 -20
  42. package/dist/core/index.js +68 -10130
  43. package/dist/core/index.js.map +3 -65
  44. package/dist/core/permissions.d.ts +1 -1
  45. package/dist/core/redis-cache.d.ts +1 -1
  46. package/dist/formatters/index.js +41 -110
  47. package/dist/formatters/index.js.map +3 -4
  48. package/dist/handlers/index.js +5 -37
  49. package/dist/handlers/index.js.map +3 -4
  50. package/dist/index.d.ts +21 -21
  51. package/dist/index.js +641 -16325
  52. package/dist/index.js.map +3 -92
  53. package/dist/managers/advanced.d.ts +3 -3
  54. package/dist/managers/application.d.ts +2 -2
  55. package/dist/managers/base.d.ts +1 -1
  56. package/dist/managers/emoji.d.ts +2 -2
  57. package/dist/managers/guild-resources.d.ts +6 -6
  58. package/dist/managers/guild.d.ts +3 -3
  59. package/dist/managers/index.d.ts +4 -8
  60. package/dist/managers/index.js +51 -4060
  61. package/dist/managers/index.js.map +3 -29
  62. package/dist/managers/member.d.ts +2 -2
  63. package/dist/managers/message.d.ts +14 -6
  64. package/dist/managers/role.d.ts +2 -2
  65. package/dist/managers/thread.d.ts +3 -3
  66. package/dist/managers/user.d.ts +7 -4
  67. package/dist/rest/index.d.ts +10 -35
  68. package/dist/rest/index.js +57 -2184
  69. package/dist/rest/index.js.map +3 -18
  70. package/dist/rest/limiter.d.ts +9 -1
  71. package/dist/rest/webhook.d.ts +2 -8
  72. package/dist/sharding/bus.d.ts +2 -2
  73. package/dist/sharding/cluster.d.ts +45 -5
  74. package/dist/sharding/context.d.ts +45 -3
  75. package/dist/sharding/gateway-bot.d.ts +2 -1
  76. package/dist/sharding/health.d.ts +1 -1
  77. package/dist/sharding/identify.d.ts +12 -0
  78. package/dist/sharding/index.d.ts +44 -11
  79. package/dist/sharding/index.js +60 -4620
  80. package/dist/sharding/index.js.map +3 -33
  81. package/dist/sharding/supervisor.d.ts +4 -2
  82. package/dist/structures/audit-log.d.ts +1 -1
  83. package/dist/structures/base.d.ts +6 -6
  84. package/dist/structures/channels.d.ts +1 -1
  85. package/dist/structures/embed.d.ts +1 -1
  86. package/dist/structures/index.d.ts +14 -14
  87. package/dist/structures/index.js +109 -2382
  88. package/dist/structures/index.js.map +3 -16
  89. package/dist/structures/interactions.d.ts +13 -9
  90. package/dist/structures/options.d.ts +1 -1
  91. package/dist/structures/permissions.d.ts +2 -2
  92. package/dist/structures/resources.d.ts +10 -10
  93. package/dist/structures/sticker.d.ts +1 -1
  94. package/dist/types/gateway.d.ts +2 -79
  95. package/dist/types/index.d.ts +0 -6
  96. package/dist/types/index.js +41 -272
  97. package/dist/types/index.js.map +3 -6
  98. package/dist/utils/index.js +23 -209
  99. package/dist/utils/index.js.map +3 -5
  100. package/dist/voice/connection.d.ts +200 -0
  101. package/dist/voice/crypto.d.ts +50 -0
  102. package/dist/voice/dave.d.ts +85 -0
  103. package/dist/voice/effects.d.ts +31 -0
  104. package/dist/voice/emitter.d.ts +14 -0
  105. package/dist/voice/gateway.d.ts +59 -0
  106. package/dist/voice/index.d.ts +25 -228
  107. package/dist/voice/index.js +111 -442
  108. package/dist/voice/index.js.map +3 -4
  109. package/dist/voice/libopus.d.ts +88 -0
  110. package/dist/voice/networking.d.ts +80 -0
  111. package/dist/voice/ogg.d.ts +24 -0
  112. package/dist/voice/opus.d.ts +18 -0
  113. package/dist/voice/player.d.ts +79 -0
  114. package/dist/voice/protocol.d.ts +76 -0
  115. package/dist/voice/receiver.d.ts +59 -0
  116. package/dist/voice/resource.d.ts +102 -0
  117. package/dist/voice/udp.d.ts +40 -0
  118. package/dist/ws/close-codes.d.ts +1 -1
  119. package/dist/ws/index.d.ts +25 -4
  120. package/dist/ws/index.js +47 -1336
  121. package/dist/ws/index.js.map +3 -17
  122. package/dist/ws/protocol.d.ts +1 -1
  123. package/dist/ws/send-budget.d.ts +0 -2
  124. package/dist/ws/state.d.ts +0 -10
  125. package/package.json +19 -16
@@ -8,9 +8,9 @@ export interface SupervisorOptions {
8
8
  maxDelay?: number;
9
9
  /** Random spread added to each delay, as a fraction of it (0-1, default 0). */
10
10
  jitter?: number;
11
- /** Give up after this many restarts inside `window` (default unlimited). */
11
+ /** Give up after this many restarts without a stable `window` between them (default unlimited). */
12
12
  maxRestarts?: number;
13
- /** The time over which restarts are counted, and after which a stable cluster is forgiven (default 60,000). */
13
+ /** How long a restarted cluster must run before its earlier crashes are forgiven (default 60,000). */
14
14
  window?: number;
15
15
  }
16
16
  /**
@@ -27,6 +27,8 @@ export declare class ShardSupervisor {
27
27
  * `maxRestarts` times inside `window`.
28
28
  */
29
29
  next(id: number, now?: number): number | null;
30
+ /** Restarts of a cluster since it last ran stably for a whole `window`. */
31
+ attempts(id: number): number;
30
32
  /** Forgets a cluster's crashes, e.g. after a deliberate respawn. */
31
33
  reset(id?: number): void;
32
34
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseStructure } from "./base.js";
2
- import type { APIAuditLog, APIAuditLogEntry, APIAuditLogChange, APIAuditLogOptions } from "@lunibee/types";
2
+ import type { APIAuditLog, APIAuditLogEntry, APIAuditLogChange, APIAuditLogOptions } from "../types/index.js";
3
3
  /** What `info` holds for each action type that carries extra details (numbers are parsed from Discord's strings). */
4
4
  export interface AuditLogInfoByType {
5
5
  /** Overwrite created, updated or deleted: a role (`type` 0) or a member (`type` 1). */
@@ -1,4 +1,4 @@
1
- import { type ChannelKind, type MessageCreateOptions, type MessageEditOptions, type UnknownChannelKind } from "@lunibee/types";
1
+ import { type ChannelKind, type MessageCreateOptions, type MessageEditOptions, type UnknownChannelKind } from "../types/index.js";
2
2
  import type { ChannelOfKind } from "./channels.js";
3
3
  /** Common Discord snowflake-backed structure. */
4
4
  export declare class BaseStructure {
@@ -42,7 +42,7 @@ export interface ResourceContext {
42
42
  addMemberRole?(guildId: string, userId: string, roleId: string, reason?: string): Promise<void>;
43
43
  removeMemberRole?(guildId: string, userId: string, roleId: string, reason?: string): Promise<void>;
44
44
  /** Collects the client's interactions (a `Collector` over `interactionCreate`). Used by message and interaction collectors. */
45
- collectInteractions?(options: import("@lunibee/core").CollectorOptions<import("./interactions.js").Interaction>): import("@lunibee/core").Collector<string, import("./interactions.js").Interaction>;
45
+ collectInteractions?(options: import("../core/index.js").CollectorOptions<import("./interactions.js").Interaction>): import("../core/index.js").Collector<string, import("./interactions.js").Interaction>;
46
46
  editPermissionOverwrite?(channelId: string, targetId: string, changes: PermissionOverwriteChanges, options?: {
47
47
  type?: 0 | 1;
48
48
  reason?: string;
@@ -73,7 +73,7 @@ export declare class User extends BaseStructure {
73
73
  system: boolean;
74
74
  flags: number;
75
75
  discriminator: string | null;
76
- constructor(data: import("@lunibee/types").UserData);
76
+ constructor(data: import("../types/index.js").UserData);
77
77
  /** Effective display name — global name, falling back to username. */
78
78
  get displayName(): string;
79
79
  /** Returns the user's avatar URL, or null if they have no avatar. */
@@ -96,7 +96,7 @@ export declare class Channel extends BaseStructure {
96
96
  rateLimitPerUser?: number;
97
97
  position?: number;
98
98
  /** Role and member permission overwrites (empty for DMs and when not provided). */
99
- permissionOverwrites: import("@lunibee/types").APIOverwrite[];
99
+ permissionOverwrites: import("../types/index.js").APIOverwrite[];
100
100
  /**
101
101
  * A placeholder built from a message's `channel_id`, not from channel
102
102
  * data: its `type`, `name`, `parentId` and `permissionOverwrites` are not
@@ -104,7 +104,7 @@ export declare class Channel extends BaseStructure {
104
104
  */
105
105
  partial: boolean;
106
106
  /** Creates a channel structure from Discord channel data. `options.partial` marks a placeholder. */
107
- constructor(data: import("@lunibee/types").APIChannel, context?: ResourceContext, options?: {
107
+ constructor(data: import("../types/index.js").APIChannel, context?: ResourceContext, options?: {
108
108
  partial?: boolean;
109
109
  });
110
110
  /** Sends a message to this channel. @param options Message payload. @returns The created message. @throws {Error} If the channel is not attached to a client. */
@@ -207,7 +207,7 @@ export declare class Guild extends BaseStructure {
207
207
  maxVideoChannelUsers?: number;
208
208
  /** Whether the boost progress bar shows. */
209
209
  premiumProgressBarEnabled: boolean;
210
- constructor(data: import("@lunibee/types").APIGuild);
210
+ constructor(data: import("../types/index.js").APIGuild);
211
211
  /** Returns the guild icon URL, or null if no icon is set. */
212
212
  iconURL(options?: ImageURLOptions): string | null;
213
213
  /** Returns the guild splash URL, or null if none. */
@@ -1,6 +1,6 @@
1
1
  import { Channel, User, type ResourceContext } from "./base.js";
2
2
  import { TextChannel } from "./resources.js";
3
- import type { APIChannel, APIForumTag, APIPartialEmoji, APIThreadMetadata } from "@lunibee/types";
3
+ import type { APIChannel, APIForumTag, APIPartialEmoji, APIThreadMetadata } from "../types/index.js";
4
4
  /** A guild announcement (news) channel. */
5
5
  export declare class NewsChannel extends TextChannel {
6
6
  }
@@ -1,4 +1,4 @@
1
- import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedMedia } from "@lunibee/types";
1
+ import type { APIEmbed, APIEmbedAuthor, APIEmbedField, APIEmbedFooter, APIEmbedMedia } from "../types/index.js";
2
2
  /**
3
3
  * A rich Embed structure that wraps a Discord API embed object.
4
4
  * Provides typed accessors and a fluent builder interface.
@@ -1,9 +1,9 @@
1
1
  /** Resource structures for Discord messages and related entities. */
2
- import type { MessageCreateOptions, MessageEditOptions } from "@lunibee/types";
2
+ import type { MessageCreateOptions, MessageEditOptions } from "../types/index.js";
3
3
  import { BaseStructure, Channel, User } from "./base.js";
4
4
  import { GuildMember } from "./resources.js";
5
5
  import type { ComponentInteraction } from "./interactions.js";
6
- import type { Collector, CollectorOptions } from "@lunibee/core";
6
+ import type { Collector, CollectorOptions } from "../core/index.js";
7
7
  /** Options for {@link Message.createComponentCollector}. */
8
8
  export interface ComponentCollectorOptions extends CollectorOptions<ComponentInteraction> {
9
9
  /** Only this component type (2 button, 3 string select...). */
@@ -22,22 +22,22 @@ export declare class Message extends BaseStructure {
22
22
  flags: number;
23
23
  /** Message creation timestamp (from timestamp field or snowflake). */
24
24
  readonly timestamp: Date;
25
- readonly attachments: import("@lunibee/types").APIAttachment[];
26
- readonly embeds: import("@lunibee/types").APIEmbed[];
25
+ readonly attachments: import("../types/index.js").APIAttachment[];
26
+ readonly embeds: import("../types/index.js").APIEmbed[];
27
27
  readonly mentions: User[];
28
28
  readonly mentionRoles: string[];
29
29
  pinned: boolean;
30
30
  mentionEveryone: boolean;
31
31
  type: number;
32
- readonly reference?: import("@lunibee/types").APIMessageReference;
33
- readonly components: import("@lunibee/types").APIMessageComponent[];
32
+ readonly reference?: import("../types/index.js").APIMessageReference;
33
+ readonly components: import("../types/index.js").APIMessageComponent[];
34
34
  readonly referencedMessage?: Message | null;
35
35
  /** Stickers sent with the message (`sticker_items`). */
36
- readonly stickers: import("@lunibee/types").APIStickerItem[];
36
+ readonly stickers: import("../types/index.js").APIStickerItem[];
37
37
  /** The poll, when the message is one. */
38
- readonly poll: import("@lunibee/types").APIPoll | null;
38
+ readonly poll: import("../types/index.js").APIPoll | null;
39
39
  /** For a forwarded message, the snapshot of the original. */
40
- readonly messageSnapshots: import("@lunibee/types").APIMessageSnapshot[];
40
+ readonly messageSnapshots: import("../types/index.js").APIMessageSnapshot[];
41
41
  /**
42
42
  * The author as a guild member, on guild messages from the Gateway. Its
43
43
  * `permissions` are computed from the cached roles; `member.kick()` and the
@@ -45,13 +45,13 @@ export declare class Message extends BaseStructure {
45
45
  */
46
46
  member: GuildMember | null;
47
47
  /** Creates a message structure from Discord message data. */
48
- constructor(data: import("@lunibee/types").APIMessage, context?: ResourceContext);
48
+ constructor(data: import("../types/index.js").APIMessage, context?: ResourceContext);
49
49
  /** Whether embeds are suppressed on this message. */
50
50
  get embedsSuppressed(): boolean;
51
- /** Unix timestamp (ms) at which the message was created — discord.js parity.
51
+ /** Unix timestamp (ms) at which the message was created.
52
52
  * Derived from the message `timestamp`, which itself falls back to the id snowflake. */
53
53
  get createdTimestamp(): number;
54
- /** Date at which the message was created — discord.js parity. Overrides the
54
+ /** Date at which the message was created. Overrides the
55
55
  * snowflake-only `BaseStructure.createdAt` to honour the message `timestamp`. */
56
56
  get createdAt(): Date;
57
57
  /** Edits this message. @param options Message fields to change. @returns The updated message. @throws {Error} If the message is not attached to a client. */
@@ -93,8 +93,8 @@ export declare class Message extends BaseStructure {
93
93
  get isEphemeral(): boolean;
94
94
  /** Whether this message is currently pinned in its channel. */
95
95
  get isPinned(): boolean;
96
- /** Whether this is a system-generated message (join, boost, etc). Mirrors
97
- * discord.js: a message is "system" unless its type is one of the user-authored
96
+ /** Whether this is a system-generated message (join, boost, etc).
97
+ * A message is "system" unless its type is one of the user-authored
98
98
  * types — Default (0), Reply (19), ChatInputCommand (20) or ContextMenuCommand (23). */
99
99
  get isSystemMessage(): boolean;
100
100
  /** Whether this message was crossposted from an announcement channel. */