Merge branch 'master' into playlist-limit-config

This commit is contained in:
Max Isom 2021-12-18 12:13:13 -06:00
commit e8e7591730
No known key found for this signature in database
GPG key ID: 25C9B1A7F6798880
15 changed files with 598 additions and 166 deletions

View file

@ -49,7 +49,6 @@ export default class implements Command {
const player = this.playerManager.get(msg.guild!.id);
const queueOldSize = player.queueSize();
const wasPlayingSong = player.getCurrent() !== null;
if (args.length === 0) {
@ -150,6 +149,28 @@ export default class implements Command {
const firstSong = newSongs[0];
let statusMsg = '';
if (player.voiceConnection === null) {
await player.connect(targetVoiceChannel);
// Resume / start playback
await player.play();
if (wasPlayingSong) {
statusMsg = 'resuming playback';
}
}
// Build response message
if (statusMsg !== '') {
if (extraMsg === '') {
extraMsg = statusMsg;
} else {
extraMsg = `${statusMsg}, ${extraMsg}`;
}
}
if (extraMsg !== '') {
extraMsg = ` (${extraMsg})`;
}
@ -159,14 +180,5 @@ export default class implements Command {
} else {
await res.stop(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${extraMsg}`);
}
if (queueOldSize === 0 && !wasPlayingSong) {
// Only auto-play if queue was empty before and nothing was playing
if (player.voiceConnection === null) {
await player.connect(targetVoiceChannel);
}
await player.play();
}
}
}