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:
NoLogicAlan committed 2026-05-21 02:04:05 +03:00
1 parent bc1fe82919
commit 0f2ee99f1e
23 files changed
+665 -170

No files matched your search

-1
View File
@@ -8,7 +8,6 @@
* Edit only here; FluxerListManager.mjs and commands/vote.mjs import from this file.
*/
export const FLUXERLIST = {
/** Base URL for all FluxerList API v1 endpoints */
BASE_URL: "https://fluxerlist.com/api/v1",
-5
View File
@@ -70,7 +70,6 @@ import { logger } from "./Logger.mjs";
}
}
/** Helper: returns a human-readable label for a ConnectionState value */
function stateLabel(cs) {
if (cs === ConnectionState?.CONN_CONNECTED) return "CONN_CONNECTED";
@@ -82,7 +81,6 @@ function stateLabel(cs) {
return String(cs);
}
/**
* A voice connection that wraps a LiveKit Room obtained via the Fluxer
* gateway. Exposes the same interface as revoice.js's VoiceConnection:
@@ -183,7 +181,6 @@ export class FluxerVoiceConnection extends EventEmitter {
}
}
/**
* Revoice-compatible class that uses the Fluxer gateway for voice joins.
*
@@ -510,7 +507,6 @@ export class FluxerRevoice extends EventEmitter {
nativeConnection,
});
room.on(RoomEvent.Disconnected, (reason) => {
const isIntentional = this._intentionalDisconnects.has(String(channelId));
const reasonLabel = isIntentional ? "intentional" : (reason ?? "unexpected");
@@ -532,7 +528,6 @@ export class FluxerRevoice extends EventEmitter {
connection.emit("disconnect");
});
room.on(RoomEvent.ParticipantConnected, (participant) => {
const userId = participant?.identity ?? participant?.sid;
if (userId) {
-7
View File
@@ -46,7 +46,6 @@ export class VoiceStateCache {
this._lruBotKeys = [];
}
/** Build composite key "guildId:userId" (both cleaned to digits only) */
static userKey(guildId, userId) {
return `${String(guildId ?? "").replace(/\D/g, "")}:${String(userId ?? "").replace(/\D/g, "")}`;
@@ -57,7 +56,6 @@ export class VoiceStateCache {
return `${String(guildId ?? "").replace(/\D/g, "")}:${String(channelId ?? "").replace(/\D/g, "")}`;
}
/**
* Update voice state for a user.
*
@@ -130,7 +128,6 @@ export class VoiceStateCache {
}
}
/**
* Check if there are any human users in a specific channel.
* O(1) via channelMembers index.
@@ -224,7 +221,6 @@ export class VoiceStateCache {
this.updateUser({ guildId, userId, channelId, isBot });
}
/**
* Remove all entries for a specific guild (used on GuildDelete).
*
@@ -331,7 +327,6 @@ export class VoiceStateCache {
}
}
/**
* Get the "observedVoiceUsers" size (human count).
* Backward-compat with `this.observedVoiceUsers.size`
@@ -480,7 +475,6 @@ export class VoiceStateCache {
return this.botLocations.has(compositeKey);
}
/**
* Default iterator — iterates human users.
* Yields [userId, {channelId, guildId}] — same shape as old observedVoiceUsers Map.
@@ -608,7 +602,6 @@ export class VoiceStateCache {
}
}
get stats() {
return {
humanUsers: this.userLocations.size,