diff --git a/package.json b/package.json index 9116786..5caf9ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navys-music-bot", - "version": "1.1.1", + "version": "1.1.2", "description": "A bot that plays music on discord", "main": "build/index.js", "repository": "https://git.corgi.wtf/Navy.gif/music-bot.git", diff --git a/src/client/components/MusicPlayer.ts b/src/client/components/MusicPlayer.ts index e7031dc..e4fec78 100644 --- a/src/client/components/MusicPlayer.ts +++ b/src/client/components/MusicPlayer.ts @@ -120,6 +120,8 @@ class MusicPlayer implements Initialisable if (!result) return null; this.#queue.push(result); + // Also add to radio playlist + this.#shuffleList.push(result); return result; } diff --git a/src/client/components/commands/Rescan.ts b/src/client/components/commands/Rescan.ts index 3f64d2c..bc2302c 100644 --- a/src/client/components/commands/Rescan.ts +++ b/src/client/components/commands/Rescan.ts @@ -25,6 +25,7 @@ class PingCommand extends Command { const diff = await this.client.musicPlayer.library.scanLibrary(args.rebuild?.value as boolean); const songs = this.client.musicPlayer.library.size; + this.client.musicPlayer.reshuffle(); return `Found ${songs} tracks with ${diff} new ones`; } } diff --git a/src/client/components/commands/Stats.ts b/src/client/components/commands/Stats.ts index 4f033e6..2ba5e28 100644 --- a/src/client/components/commands/Stats.ts +++ b/src/client/components/commands/Stats.ts @@ -31,8 +31,8 @@ class StatsCommand extends Command return 'Stats reset'; } const { stats } = this.client.musicPlayer.library; - const mostPlayed = stats.sort((a, b) => b.plays - a.plays).slice(0, 10); - const mostSkipped = stats.sort((a, b) => b.skips - a.skips).slice(0, 10); + const mostPlayed = stats.sort((a, b) => b.plays - a.plays).filter(entry => entry.plays > 0).slice(0, 10); + const mostSkipped = stats.sort((a, b) => b.skips - a.skips).filter(entry => entry.skips > 0).slice(0, 10); let stat = 'plays'; const mapper = (entry: MusicStatsEntry, pos: number) => diff --git a/src/client/components/inhibitors/SameVC.ts b/src/client/components/inhibitors/SameVC.ts index 90c74f6..22c4ced 100644 --- a/src/client/components/inhibitors/SameVC.ts +++ b/src/client/components/inhibitors/SameVC.ts @@ -19,8 +19,10 @@ class SameVCInhibitor extends Inhibitor return super._fail('This command cannot be executed outside of a server'); const { me } = guild.members; - if (!member?.voice || member.voice.channelId !== me?.voice.channelId) - super._fail('Only vc participants can queue songs'); + if (!me) + return super._fail('What?'); + if (!member?.voice || member.voice.channelId !== me.voice.channelId) + return super._fail('Only vc participants can queue songs'); return super._succeed(); }