mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
bye
This commit is contained in:
1 parent
35aab94a53
commit
3ef54117bb
27 files changed
+5
-156
No files matched your search
@@ -179,8 +179,6 @@ export class LavalinkManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Fluxer 3.0 sharding: gateway payloads are guild-scoped — route to the
|
||||
// shard that owns this guild (single process: always shard 0, as before).
|
||||
const targetShardId = ShardingUtils.shardIdForGuild(this._client, guildId);
|
||||
|
||||
if (typeof this._client?.ws?.send === "function") {
|
||||
@@ -211,16 +209,12 @@ export class LavalinkManager extends EventEmitter {
|
||||
|
||||
const attachRawWs = () => {
|
||||
try {
|
||||
// Fluxer 3.0 + sharding: getShards() replaces the 2.2 `shards` Map
|
||||
// property, and a sharded child owns several shards — track the raw
|
||||
// socket of EVERY local shard, not just shard 0.
|
||||
const wsObjs = ShardingUtils.localShardSockets(client);
|
||||
if (wsObjs.length === 0) return;
|
||||
|
||||
if (!this._rawWsObjs) this._rawWsObjs = new Set();
|
||||
const attached = this._rawWsObjs;
|
||||
|
||||
// Detach listeners from sockets that went away (reconnects).
|
||||
for (const old of attached) {
|
||||
if (wsObjs.includes(old)) continue;
|
||||
try {
|
||||
@@ -246,7 +240,6 @@ export class LavalinkManager extends EventEmitter {
|
||||
attached.delete(old);
|
||||
}
|
||||
|
||||
// Create the shared handlers once (stateless parsers).
|
||||
if (!this._rawWsHandler) {
|
||||
const botId = this._client?.user?.id;
|
||||
let _vsuLogCooldown = 0;
|
||||
@@ -319,7 +312,6 @@ export class LavalinkManager extends EventEmitter {
|
||||
attached.add(wsObj);
|
||||
}
|
||||
|
||||
// Legacy singular field kept in sync (first socket).
|
||||
this._rawWsObj = wsObjs[0] ?? null;
|
||||
} catch (e) {
|
||||
logger.warn("[LavalinkManager] Raw WS setup error:", e.message);
|
||||
|
||||
@@ -14,10 +14,6 @@ import { cleanId } from "../utils/Utils.mjs";
|
||||
import { getMessageGuildId } from "../ui/index.mjs";
|
||||
import { Dashboard } from "../dashboard/Dashboard.mjs";
|
||||
|
||||
// Module-level ID helpers from the original PlayerManager.mjs. They live in
|
||||
// this module (not the base file) because it is the shared leaf of the three
|
||||
// PlayerManager modules, which keeps the import graph acyclic:
|
||||
// PlayerManager.mjs → PlayerEventsMixin.mjs ← PlayerLifecycleMixin.mjs.
|
||||
/** @private @param {Player} player @param {object|null} [fallbackChannel=null] @returns {string} Cleaned guild ID. */
|
||||
function getPlayerGuildId(player, fallbackChannel = null) {
|
||||
return cleanId(
|
||||
|
||||
@@ -21,8 +21,6 @@ import { getGlobalColor, getMessageGuildId } from "../ui/index.mjs";
|
||||
import { hasHumansInChannel, iterateVoiceStates } from "../voice/VoiceStateResolver.mjs";
|
||||
import { getPlayerChannelId } from "./PlayerEventsMixin.mjs";
|
||||
|
||||
// Module-level join/permission helpers from the original PlayerManager.mjs
|
||||
// (only initPlayer below uses them, so they stay private to this module).
|
||||
/** @private Check whether the bot has required voice permissions in a channel. @param {object} client @param {string} channelId @returns {boolean} True if the bot can connect, speak, and use VAD. */
|
||||
function botHasVoicePermissions(client, channelId) {
|
||||
try {
|
||||
@@ -297,9 +295,6 @@ const PlayerLifecycleMixin = {
|
||||
?? this.getPlayerByChannelId(cleanChannelId);
|
||||
if (existing) {
|
||||
if (isPlayerConnectionDead(existing)) {
|
||||
// Zombie in the map (e.g. 24/7 player whose voice session died):
|
||||
// returning it would make !play silently do nothing. Evict it and
|
||||
// fall through to spawn a fresh live player.
|
||||
logger.voice247(
|
||||
`[PlayerManager] Existing player for ${cleanChannelId} has a dead connection — evicting before initPlayer.`
|
||||
);
|
||||
|
||||
@@ -224,6 +224,4 @@ export class PlayerManager {
|
||||
|
||||
}
|
||||
|
||||
// Attach the split-out concerns: dashboard event wiring (PlayerEventsMixin)
|
||||
// and voice-channel detection / player lifecycle (PlayerLifecycleMixin).
|
||||
applyMixins(PlayerManager, PlayerEventsMixin, PlayerLifecycleMixin);
|
||||
@@ -414,6 +414,4 @@ export class FluxerAudioBridge extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Attach the split-out concerns: stream pipeline building/routing
|
||||
// (StreamPipeline) and Lavalink REST HTTP helpers (HttpStreams).
|
||||
applyMixins(FluxerAudioBridge, StreamPipeline, HttpStreams);
|
||||
@@ -309,7 +309,6 @@ const PlaybackMixin = {
|
||||
if (result === "finished" && !this._skipping && !this.leaving && !this._paused) {
|
||||
this._handleTrackEnd();
|
||||
} else if (result === "stopped") {
|
||||
// Stopped intentionally (skip/seek/stop) — nothing to do.
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -339,20 +339,12 @@ class Player extends EventEmitter {
|
||||
return;
|
||||
}
|
||||
|
||||
// 1) Detach from playerMap (active + home keys) so rejoin paths no
|
||||
// longer see a "player already here" and skip.
|
||||
detachPlayerFromManager(ctx, this, channelId);
|
||||
|
||||
// 2) Arm the ctx-level rejoin BEFORE destroying ourselves — the timer
|
||||
// must outlive this instance.
|
||||
ctx.schedule247Rejoin(channelId, guildId);
|
||||
|
||||
// 3) Notify (dashboard close/stopplay); the manager-level autoleave
|
||||
// listeners suppress the actual leave for 24/7 channels, so this is
|
||||
// notification-only.
|
||||
this.emit("autoleave");
|
||||
|
||||
// 4) Finally destroy the dead instance.
|
||||
this.destroy();
|
||||
}
|
||||
|
||||
@@ -510,14 +502,6 @@ class Player extends EventEmitter {
|
||||
this._assertSelfDeaf(vm, channelId);
|
||||
|
||||
if (typeof voiceConn.on === "function") {
|
||||
// Self-deaf keeper: Fluxer's VoiceManager answers every
|
||||
// requestVoiceStateSync event (emitted by conn.stop()/stopVideo(),
|
||||
// which the audio bridge triggers on EVERY play() and stop()) with a
|
||||
// gateway VoiceStateUpdate that resets self_deaf to false — silently
|
||||
// un-deafening the bot the moment the first track starts and again on
|
||||
// every skip/stop/track-end. The manager registers its own sync
|
||||
// listener inside registerConnection() (before join() resolved), so
|
||||
// this listener runs AFTER it and our re-deafen state update wins.
|
||||
voiceConn.on("requestVoiceStateSync", () => {
|
||||
if (this.leaving || this._destroyed) return;
|
||||
this._assertSelfDeaf(vm, channelId);
|
||||
@@ -536,11 +520,6 @@ class Player extends EventEmitter {
|
||||
const gId = cleanId(this._guildId ?? "");
|
||||
|
||||
if (mode === "on" && cId && gId) {
|
||||
// 24/7: the voice session is gone but the commitment stands.
|
||||
// Detach this now-dead player (a zombie in the map makes every
|
||||
// rejoin path bail with "already has a player"), arm a
|
||||
// bot-level rejoin that survives our own destroy, notify, then
|
||||
// destroy ourselves.
|
||||
logger.player("[Player] serverLeave in 24/7 mode — detaching and scheduling rejoin");
|
||||
this._detachAndSchedule247Rejoin(cId, gId);
|
||||
} else {
|
||||
@@ -981,8 +960,6 @@ class Player extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
// Attach the split-out concerns: playback advancement (PlaybackMixin), search
|
||||
// & queue-filling (SearchMixin), and user-facing rendering (DisplayMixin).
|
||||
applyMixins(Player, PlaybackMixin, SearchMixin, DisplayMixin);
|
||||
|
||||
export { Player as default, Player, Queue };
|
||||
@@ -229,11 +229,6 @@ const SearchMixin = {
|
||||
if (!isUrl) throw searchErr;
|
||||
}
|
||||
let lcTracks = result?.tracks ?? [];
|
||||
// Set when the only results we have came from the oEmbed title-search
|
||||
// fallback. That path resolves a SINGLE video (direct URL load was
|
||||
// bot-blocked), so its result list is a search page — NOT a playlist.
|
||||
// Bulk-queueing it would queue a bunch of "related" songs instead of
|
||||
// the one requested video (original fluxer bug reported by users).
|
||||
let fromTitleFallback = false;
|
||||
|
||||
if (isUrl && lcTracks.length === 0 && ytId) {
|
||||
@@ -288,9 +283,6 @@ const SearchMixin = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Pick the track to queue. For a title-search fallback, prefer the
|
||||
// result that is the exact video the user requested (search may rank
|
||||
// covers/remixes first); otherwise take the first result.
|
||||
let firstTrack = lcTracks[0];
|
||||
if (fromTitleFallback && ytId) {
|
||||
firstTrack = lcTracks.find(t => (t?.info?.identifier ?? t?.identifier) === ytId) ?? lcTracks[0];
|
||||
@@ -299,8 +291,6 @@ const SearchMixin = {
|
||||
}
|
||||
}
|
||||
|
||||
// Only a genuine playlist/mix URL load may bulk-queue. A title-search
|
||||
// fallback for a single video must queue exactly one track.
|
||||
if (isUrl && !fromTitleFallback && lcTracks.length > 1) {
|
||||
const videos = lcTracks.map(t => this._lcTrackToVideo(t, trackMeta)).filter(Boolean);
|
||||
this.addManyToQueue(videos, top);
|
||||
|
||||
Reference in new issue
Block a user