Bugfix to sameVC inhibitor
Improve some functionality
This commit is contained in:
Erik 2024-03-30 09:42:25 +02:00
parent b8f2aab64f
commit 6a6be77dbd
5 changed files with 10 additions and 5 deletions

View File

@ -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",

View File

@ -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;
}

View File

@ -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`;
}
}

View File

@ -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) =>

View File

@ -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();
}