diff --git a/src/bot/instance.ts b/src/bot/instance.ts index d2cc77e..0472fc1 100755 --- a/src/bot/instance.ts +++ b/src/bot/instance.ts @@ -747,6 +747,12 @@ export class BotInstance extends EventEmitter { } async startFm(provider: MusicProvider = this.neteaseProvider): Promise { + // Match the !fm chat-command guard: refuse before mutating the queue when + // offline, so the web /fm route can't wipe the queue + flip into FM mode + // while nothing can actually play. + if (!this.connected) { + return "Bot is not connected to TeamSpeak"; + } if (!provider.getPersonalFm) { return `Personal FM is not available for ${provider.platform}`; } diff --git a/src/music/qq.ts b/src/music/qq.ts index 29ff01e..312ca8b 100644 --- a/src/music/qq.ts +++ b/src/music/qq.ts @@ -462,6 +462,9 @@ export class QQMusicProvider implements MusicProvider { setCookie(cookie: string): void { this.cookie = cookie; + // Reset radar pagination so a re-login (different account) starts from the + // first page rather than inheriting the previous account's cursor. + this.radarPage = 1; } getCookie(): string { diff --git a/src/web/api/player.ts b/src/web/api/player.ts index e4fa8e8..b1711fe 100644 --- a/src/web/api/player.ts +++ b/src/web/api/player.ts @@ -97,7 +97,13 @@ export function createPlayerRouter( : "netease" ); const message = await bot.startFm(provider); - res.json({ ok: !message.startsWith("No FM songs") && !message.includes("not available"), message }); + res.json({ + ok: + !message.startsWith("No FM songs") && + !message.includes("not available") && + !message.includes("not connected"), + message, + }); } catch (err) { res.status(500).json({ error: (err as Error).message }); }