fix(audio): prevent pops during playback controls

This commit is contained in:
EvolvedGhost committed 2026-10-17 23:30:18 +08:00
1 parent c26998d296
commit a0f0b49a4e
3 files changed
+79 -18

No files matched your search

+2 -1
View File
@@ -285,7 +285,7 @@ export function createPlayerRouter(
if (index >= queue.size()) {
return { status: 400 as const, body: { error: "Invalid queue index" } };
}
bot.getPlayer().stop();
bot.getPlayer().stop(true);
bot.getPlayer().resetFailures();
const song = queue.playAt(index);
if (!song) {
@@ -293,6 +293,7 @@ export function createPlayerRouter(
}
const ok = await bot.resolveAndPlay(song);
if (!ok) {
bot.getPlayer().stop();
return { body: { message: `Cannot play: ${song.name}` } };
}
return { body: { message: `Now playing: ${song.name} - ${song.artist}` } };