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

-12
View File
@@ -163,7 +163,6 @@ export class PlayerManager {
this._lastfm = null;
}
/**
* Add a channel to the guild→player reverse index.
* Called after a successful player join.
@@ -275,13 +274,11 @@ export class PlayerManager {
writable: true,
});
const emit = (type, data) => {
if (!this.dashboard?.enabled) return;
this.dashboard.updatePlayer({ type, data }, player);
};
const emitGlobal = (type) => {
if (!this.dashboard?.enabled) return;
this.dashboard.playerUpdate({ type }, player);
@@ -315,7 +312,6 @@ export class PlayerManager {
}
};
player.on("roomfetched", () => {
emitGlobal("init");
sendUserUpdates("join");
@@ -374,7 +370,6 @@ export class PlayerManager {
emit("stopplay", null);
});
player.queue?.on("queue", (queueEvent) => {
const serialised = { type: queueEvent.type };
switch (queueEvent.type) {
@@ -440,7 +435,6 @@ export class PlayerManager {
return this.locale.translate(guildId, key, replacements);
}
/**
* Attempt to detect the voice channel a user is currently in.
* @param {Message} message
@@ -562,7 +556,6 @@ export class PlayerManager {
return null;
}
/**
* Get or create a player for the user's voice channel.
* @param {Message} message
@@ -659,7 +652,6 @@ export class PlayerManager {
return null;
}
/**
* Prompt the user to select a voice channel.
* @param {Message} msg
@@ -749,7 +741,6 @@ export class PlayerManager {
});
}
/**
* Make the player leave its current voice channel.
* @param {Message} msg
@@ -789,7 +780,6 @@ export class PlayerManager {
await msg.reply(mkEmbed(this._t(msg, "responses._common.successfullyLeft")));
}
/**
* Create and register a new Player for the given voice channel.
* @param {Message} message
@@ -972,7 +962,6 @@ export class PlayerManager {
});
});
(async () => {
const statusMsg = await message.reply(mkEmbed(this._t(message, "responses.join.joining")));
try {
@@ -1045,7 +1034,6 @@ export class PlayerManager {
})();
}
/**
* Handle the "startplay" event for Last.fm: send now-playing notification
* to all linked users in the voice channel, and schedule a deferred scrobble