mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
Add seek validation, autoplay system, progress bar & codebase cleanup
- Add seek duration validation — seeks beyond track length are rejected with clear error showing max allowed position - Add autoplay system with Last.fm similar tracks + YouTube search fallback — automatically queues similar tracks when queue ends - Add live progress bar to now playing with elapsed/total time display - Add robust ffmpeg cleanup to prevent race conditions during seek/skip/filter operations - Add proper queue advancement after seek so bot stays in voice - Add queueEnd event emission on skip/skipTo for autoplay trigger - Add _lastPlayedTrack preservation for autoplay recommendations
This commit is contained in:
1 parent
bc1fe82919
commit
0f2ee99f1e
23 files changed
+665
-170
No files matched your search
@@ -6,7 +6,6 @@ import { get247ChannelMode, remove247ChannelMode } from "./constants/Helpers247.
|
||||
import { VoiceStateCache } from "./constants/VoiceStateCache.mjs";
|
||||
import { REQUIRED_BOT_PERMISSIONS, CRITICAL_PERMISSIONS } from "./MessageHandler.mjs";
|
||||
|
||||
|
||||
/**
|
||||
* GatewayHandler — manages raw WebSocket gateway events, voice-state tracking,
|
||||
* presence rotation, and high-level Fluxer event handlers (GuildCreate,
|
||||
@@ -47,7 +46,6 @@ export class GatewayHandler {
|
||||
this._deferredDeleteCount = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate a composite key for bots in the observedVoiceBots map.
|
||||
* Bots can be in multiple guilds so we namespace by guildId.
|
||||
@@ -82,7 +80,6 @@ export class GatewayHandler {
|
||||
return { key: null, value: null };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the bot has all required permissions in a newly joined guild.
|
||||
* If critical permissions are missing, log a warning and attempt to send
|
||||
@@ -151,7 +148,6 @@ export class GatewayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Seed observedVoiceUsers / observedVoiceBots from all cached guild voice
|
||||
* states. Called once on Ready after the guild cache is populated.
|
||||
@@ -225,7 +221,6 @@ export class GatewayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Re-read the guild's voice_states cache and update observedVoiceUsers
|
||||
* for any human users found in the specified channel.
|
||||
@@ -400,7 +395,6 @@ export class GatewayHandler {
|
||||
return humansFound;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Attach a raw "message" listener to the shard-0 WebSocket so we can
|
||||
* process gateway opcodes (READY, GUILD_CREATE, VOICE_STATE_UPDATE, etc.)
|
||||
@@ -526,7 +520,6 @@ export class GatewayHandler {
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
|
||||
setupPresenceRotation() {
|
||||
if (this.presenceContents.length === 0) return;
|
||||
|
||||
@@ -575,7 +568,6 @@ export class GatewayHandler {
|
||||
this.presenceTimer = setInterval(setPresence, this.presenceInterval);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register all high-level Fluxer event listeners on the Fluxer client.
|
||||
* Call once during bot startup.
|
||||
@@ -853,7 +845,6 @@ export class GatewayHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const activeGuildPlayers = [...remix.players.playerMap.entries()].filter(([, player]) =>
|
||||
String(player?._guildId ?? "").replace(/\D/g, "") === String(guildId ?? "").replace(/\D/g, "")
|
||||
);
|
||||
@@ -1101,7 +1092,6 @@ export class GatewayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** @type {Set<string>} Channel IDs currently being rejoined (dedup guard) */
|
||||
_rejoinInProgress = new Set();
|
||||
|
||||
@@ -1202,7 +1192,6 @@ export class GatewayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invoke after the bot has connected and Moonlink has been initialised.
|
||||
* Seeds voice states, attaches raw WS listener, kicks off presence rotation,
|
||||
@@ -1511,7 +1500,6 @@ export class GatewayHandler {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Perform the actual cleanup for a guild that the bot was removed from.
|
||||
* Extracted from the GuildDelete handler so it can be called after the
|
||||
|
||||
Reference in new issue
Block a user