mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-02 04:52:50 +08:00
feat(search): source filter bar, album search, and UX polish
- Add platform source filter bar (网易云/QQ/B站) above category tabs with localStorage persistence to remember user preference - Remove "全部" option, single-source view only - Increase album/playlist card column-gap to 28px for better spacing - Sync search query to URL via router.replace so back-navigation from album/playlist detail pages restores search results - Fix !album command: add name-based album search (matching !playlist behavior) so "!album APT." searches by name instead of treating it as ID Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
997bb17ceb
commit
6d5755ced7
3 files changed
+123
-24
No files matched your search
+20
-2
@@ -638,9 +638,27 @@ export class BotInstance extends EventEmitter {
|
||||
}
|
||||
|
||||
private async cmdAlbum(cmd: ParsedCommand): Promise<string> {
|
||||
if (!cmd.args) return "Usage: !album <album ID>";
|
||||
if (!cmd.args) return "Usage: !album <album name or ID>";
|
||||
const provider = this.getProvider(cmd.flags);
|
||||
const songs = await provider.getAlbumSongs(cmd.args);
|
||||
|
||||
const id = this.extractId(cmd.args);
|
||||
const isNumericId = /^\d+$/.test(cmd.args.trim());
|
||||
|
||||
let albumId: string;
|
||||
|
||||
if (isNumericId || id !== cmd.args) {
|
||||
// Input is a numeric ID or URL containing an ID — use directly
|
||||
albumId = id;
|
||||
} else {
|
||||
// Name-based search
|
||||
const result = await provider.search(cmd.args);
|
||||
const albums = result.albums ?? [];
|
||||
if (albums.length === 0)
|
||||
return `No albums found for: ${cmd.args}`;
|
||||
albumId = albums[0].id;
|
||||
}
|
||||
|
||||
const songs = await provider.getAlbumSongs(albumId);
|
||||
if (songs.length === 0) return "Album is empty or not found";
|
||||
|
||||
this.queue.clear();
|
||||
|
||||
Reference in new issue
Block a user