mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-12 20:41:37 +02:00
Merge branch 'master' into playlist-limit-config
This commit is contained in:
commit
e8e7591730
15 changed files with 598 additions and 166 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue