@fluxerjs/core 1.2.3 → 1.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.
package/dist/index.d.mts CHANGED
@@ -339,6 +339,20 @@ declare class GuildMember extends Base {
339
339
  * if (perms.has(PermissionFlags.SendMessages)) { ... }
340
340
  */
341
341
  permissionsIn(channel: GuildChannel): BitField<"CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageExpressions" | "UseExternalStickers" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion">;
342
+ /**
343
+ * Move this member to a different voice channel or disconnect them from voice.
344
+ * Requires Move Members permission.
345
+ * @param channelId - The voice channel ID to move the member to, or null to disconnect
346
+ * @param connectionId - Optional connection ID for the specific voice session (usually not needed)
347
+ * @returns Promise that resolves when the member has been moved
348
+ * @example
349
+ * // Move member to a different voice channel
350
+ * await member.move('123456789012345678');
351
+ *
352
+ * // Disconnect member from voice
353
+ * await member.move(null);
354
+ */
355
+ move(channelId: string | null, connectionId?: string | null): Promise<void>;
342
356
  private _computeBasePermissions;
343
357
  }
344
358
 
@@ -1791,6 +1805,8 @@ declare class Client extends EventEmitter {
1791
1805
  private _ws;
1792
1806
  /** When waitForGuilds, set of guild IDs we're waiting for GUILD_CREATE on. Null when not waiting. */
1793
1807
  _pendingGuildIds: Set<string> | null;
1808
+ /** Timeout for guild stream when READY has no guilds (gateway sends only GUILD_CREATE). Cleared in finally. */
1809
+ private _guildStreamSettleTimeout;
1794
1810
  /** Per-channel message cache (channelId -> messageId -> APIMessage). Used when options.cache.messages > 0. */
1795
1811
  private _messageCaches;
1796
1812
  /** @param options - Token, REST config, WebSocket, presence, etc. */
package/dist/index.d.ts CHANGED
@@ -339,6 +339,20 @@ declare class GuildMember extends Base {
339
339
  * if (perms.has(PermissionFlags.SendMessages)) { ... }
340
340
  */
341
341
  permissionsIn(channel: GuildChannel): BitField<"CreateInstantInvite" | "KickMembers" | "BanMembers" | "Administrator" | "ManageChannels" | "ManageGuild" | "AddReactions" | "ViewAuditLog" | "PrioritySpeaker" | "Stream" | "ViewChannel" | "SendMessages" | "SendTtsMessages" | "ManageMessages" | "EmbedLinks" | "AttachFiles" | "ReadMessageHistory" | "MentionEveryone" | "UseExternalEmojis" | "Connect" | "Speak" | "MuteMembers" | "DeafenMembers" | "MoveMembers" | "UseVad" | "ChangeNickname" | "ManageNicknames" | "ManageRoles" | "ManageWebhooks" | "ManageEmojisAndStickers" | "ManageExpressions" | "UseExternalStickers" | "ModerateMembers" | "CreateExpressions" | "PinMessages" | "BypassSlowmode" | "UpdateRtcRegion">;
342
+ /**
343
+ * Move this member to a different voice channel or disconnect them from voice.
344
+ * Requires Move Members permission.
345
+ * @param channelId - The voice channel ID to move the member to, or null to disconnect
346
+ * @param connectionId - Optional connection ID for the specific voice session (usually not needed)
347
+ * @returns Promise that resolves when the member has been moved
348
+ * @example
349
+ * // Move member to a different voice channel
350
+ * await member.move('123456789012345678');
351
+ *
352
+ * // Disconnect member from voice
353
+ * await member.move(null);
354
+ */
355
+ move(channelId: string | null, connectionId?: string | null): Promise<void>;
342
356
  private _computeBasePermissions;
343
357
  }
344
358
 
@@ -1791,6 +1805,8 @@ declare class Client extends EventEmitter {
1791
1805
  private _ws;
1792
1806
  /** When waitForGuilds, set of guild IDs we're waiting for GUILD_CREATE on. Null when not waiting. */
1793
1807
  _pendingGuildIds: Set<string> | null;
1808
+ /** Timeout for guild stream when READY has no guilds (gateway sends only GUILD_CREATE). Cleared in finally. */
1809
+ private _guildStreamSettleTimeout;
1794
1810
  /** Per-channel message cache (channelId -> messageId -> APIMessage). Used when options.cache.messages > 0. */
1795
1811
  private _messageCaches;
1796
1812
  /** @param options - Token, REST config, WebSocket, presence, etc. */
package/dist/index.js CHANGED
@@ -406,7 +406,15 @@ var Message = class _Message extends Base {
406
406
  const opts = typeof options === "string" ? { content: options } : options;
407
407
  const mergedReply = replyOptions ?? (opts.ping !== void 0 || opts.replyTo !== void 0) ? { ping: opts.ping, replyTo: opts.replyTo } : void 0;
408
408
  const refMessage = mergedReply?.replyTo ?? this;
409
- const ref = refMessage instanceof _Message ? { channel_id: refMessage.channelId, message_id: refMessage.id, guild_id: refMessage.guildId ?? void 0 } : { channel_id: refMessage.channelId, message_id: refMessage.messageId, guild_id: void 0 };
409
+ const ref = refMessage instanceof _Message ? {
410
+ channel_id: refMessage.channelId,
411
+ message_id: refMessage.id,
412
+ guild_id: refMessage.guildId ?? void 0
413
+ } : {
414
+ channel_id: refMessage.channelId,
415
+ message_id: refMessage.messageId,
416
+ guild_id: void 0
417
+ };
410
418
  const payload = await _Message._createMessageBody(opts, ref, mergedReply?.ping !== false);
411
419
  return this._send(payload);
412
420
  }
@@ -1684,6 +1692,25 @@ var GuildMember = class extends Base {
1684
1692
  );
1685
1693
  return new import_util5.BitField(perms);
1686
1694
  }
1695
+ /**
1696
+ * Move this member to a different voice channel or disconnect them from voice.
1697
+ * Requires Move Members permission.
1698
+ * @param channelId - The voice channel ID to move the member to, or null to disconnect
1699
+ * @param connectionId - Optional connection ID for the specific voice session (usually not needed)
1700
+ * @returns Promise that resolves when the member has been moved
1701
+ * @example
1702
+ * // Move member to a different voice channel
1703
+ * await member.move('123456789012345678');
1704
+ *
1705
+ * // Disconnect member from voice
1706
+ * await member.move(null);
1707
+ */
1708
+ async move(channelId, connectionId) {
1709
+ await this.edit({
1710
+ channel_id: channelId,
1711
+ connection_id: connectionId
1712
+ });
1713
+ }
1687
1714
  _computeBasePermissions() {
1688
1715
  let base = 0n;
1689
1716
  const everyone = this.guild.roles.get(this.guild.id);
@@ -3219,6 +3246,8 @@ var Client = class extends import_events3.EventEmitter {
3219
3246
  _ws = null;
3220
3247
  /** When waitForGuilds, set of guild IDs we're waiting for GUILD_CREATE on. Null when not waiting. */
3221
3248
  _pendingGuildIds = null;
3249
+ /** Timeout for guild stream when READY has no guilds (gateway sends only GUILD_CREATE). Cleared in finally. */
3250
+ _guildStreamSettleTimeout = null;
3222
3251
  /** Per-channel message cache (channelId -> messageId -> APIMessage). Used when options.cache.messages > 0. */
3223
3252
  _messageCaches = null;
3224
3253
  /**
@@ -3465,6 +3494,14 @@ var Client = class extends import_events3.EventEmitter {
3465
3494
  this._pendingGuildIds = pending;
3466
3495
  return;
3467
3496
  }
3497
+ if (waitForGuilds && (data.guilds ?? []).length === 0) {
3498
+ const GUILD_STREAM_SETTLE_MS = 500;
3499
+ this._guildStreamSettleTimeout = setTimeout(() => {
3500
+ this._guildStreamSettleTimeout = null;
3501
+ this._finalizeReady();
3502
+ }, GUILD_STREAM_SETTLE_MS);
3503
+ return;
3504
+ }
3468
3505
  this._finalizeReady();
3469
3506
  }
3470
3507
  );
@@ -3494,6 +3531,10 @@ var Client = class extends import_events3.EventEmitter {
3494
3531
  }
3495
3532
  /** Disconnect from the gateway and clear cached data. */
3496
3533
  async destroy() {
3534
+ if (this._guildStreamSettleTimeout !== null) {
3535
+ clearTimeout(this._guildStreamSettleTimeout);
3536
+ this._guildStreamSettleTimeout = null;
3537
+ }
3497
3538
  if (this._ws) {
3498
3539
  this._ws.destroy();
3499
3540
  this._ws = null;
package/dist/index.mjs CHANGED
@@ -330,7 +330,15 @@ var Message = class _Message extends Base {
330
330
  const opts = typeof options === "string" ? { content: options } : options;
331
331
  const mergedReply = replyOptions ?? (opts.ping !== void 0 || opts.replyTo !== void 0) ? { ping: opts.ping, replyTo: opts.replyTo } : void 0;
332
332
  const refMessage = mergedReply?.replyTo ?? this;
333
- const ref = refMessage instanceof _Message ? { channel_id: refMessage.channelId, message_id: refMessage.id, guild_id: refMessage.guildId ?? void 0 } : { channel_id: refMessage.channelId, message_id: refMessage.messageId, guild_id: void 0 };
333
+ const ref = refMessage instanceof _Message ? {
334
+ channel_id: refMessage.channelId,
335
+ message_id: refMessage.id,
336
+ guild_id: refMessage.guildId ?? void 0
337
+ } : {
338
+ channel_id: refMessage.channelId,
339
+ message_id: refMessage.messageId,
340
+ guild_id: void 0
341
+ };
334
342
  const payload = await _Message._createMessageBody(opts, ref, mergedReply?.ping !== false);
335
343
  return this._send(payload);
336
344
  }
@@ -1611,6 +1619,25 @@ var GuildMember = class extends Base {
1611
1619
  );
1612
1620
  return new BitField(perms);
1613
1621
  }
1622
+ /**
1623
+ * Move this member to a different voice channel or disconnect them from voice.
1624
+ * Requires Move Members permission.
1625
+ * @param channelId - The voice channel ID to move the member to, or null to disconnect
1626
+ * @param connectionId - Optional connection ID for the specific voice session (usually not needed)
1627
+ * @returns Promise that resolves when the member has been moved
1628
+ * @example
1629
+ * // Move member to a different voice channel
1630
+ * await member.move('123456789012345678');
1631
+ *
1632
+ * // Disconnect member from voice
1633
+ * await member.move(null);
1634
+ */
1635
+ async move(channelId, connectionId) {
1636
+ await this.edit({
1637
+ channel_id: channelId,
1638
+ connection_id: connectionId
1639
+ });
1640
+ }
1614
1641
  _computeBasePermissions() {
1615
1642
  let base = 0n;
1616
1643
  const everyone = this.guild.roles.get(this.guild.id);
@@ -3156,6 +3183,8 @@ var Client = class extends EventEmitter3 {
3156
3183
  _ws = null;
3157
3184
  /** When waitForGuilds, set of guild IDs we're waiting for GUILD_CREATE on. Null when not waiting. */
3158
3185
  _pendingGuildIds = null;
3186
+ /** Timeout for guild stream when READY has no guilds (gateway sends only GUILD_CREATE). Cleared in finally. */
3187
+ _guildStreamSettleTimeout = null;
3159
3188
  /** Per-channel message cache (channelId -> messageId -> APIMessage). Used when options.cache.messages > 0. */
3160
3189
  _messageCaches = null;
3161
3190
  /**
@@ -3402,6 +3431,14 @@ var Client = class extends EventEmitter3 {
3402
3431
  this._pendingGuildIds = pending;
3403
3432
  return;
3404
3433
  }
3434
+ if (waitForGuilds && (data.guilds ?? []).length === 0) {
3435
+ const GUILD_STREAM_SETTLE_MS = 500;
3436
+ this._guildStreamSettleTimeout = setTimeout(() => {
3437
+ this._guildStreamSettleTimeout = null;
3438
+ this._finalizeReady();
3439
+ }, GUILD_STREAM_SETTLE_MS);
3440
+ return;
3441
+ }
3405
3442
  this._finalizeReady();
3406
3443
  }
3407
3444
  );
@@ -3431,6 +3468,10 @@ var Client = class extends EventEmitter3 {
3431
3468
  }
3432
3469
  /** Disconnect from the gateway and clear cached data. */
3433
3470
  async destroy() {
3471
+ if (this._guildStreamSettleTimeout !== null) {
3472
+ clearTimeout(this._guildStreamSettleTimeout);
3473
+ this._guildStreamSettleTimeout = null;
3474
+ }
3434
3475
  if (this._ws) {
3435
3476
  this._ws.destroy();
3436
3477
  this._ws = null;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.2.3",
6
+ "version": "1.2.4",
7
7
  "description": "A fully-featured SDK for Fluxer bots",
8
8
  "repository": {
9
9
  "type": "git",
@@ -34,12 +34,12 @@
34
34
  "dist"
35
35
  ],
36
36
  "dependencies": {
37
- "@fluxerjs/types": "1.2.3",
38
- "@fluxerjs/rest": "1.2.3",
39
- "@fluxerjs/collection": "1.2.3",
40
- "@fluxerjs/builders": "1.2.3",
41
- "@fluxerjs/ws": "1.2.3",
42
- "@fluxerjs/util": "1.2.3"
37
+ "@fluxerjs/rest": "1.2.4",
38
+ "@fluxerjs/builders": "1.2.4",
39
+ "@fluxerjs/collection": "1.2.4",
40
+ "@fluxerjs/types": "1.2.4",
41
+ "@fluxerjs/util": "1.2.4",
42
+ "@fluxerjs/ws": "1.2.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^20.0.0",