mirror of
https://github.com/BluemediaGER/muse.git
synced 2024-11-10 03:55:29 +01:00
Always resume
This commit is contained in:
parent
f1756b9e9c
commit
e4a8dde776
|
@ -46,7 +46,6 @@ export default class implements Command {
|
||||||
|
|
||||||
const player = this.playerManager.get(msg.guild!.id);
|
const player = this.playerManager.get(msg.guild!.id);
|
||||||
|
|
||||||
const queueOldSize = player.queueSize();
|
|
||||||
const wasPlayingSong = player.getCurrent() !== null;
|
const wasPlayingSong = player.getCurrent() !== null;
|
||||||
|
|
||||||
if (args.length === 0) {
|
if (args.length === 0) {
|
||||||
|
@ -147,6 +146,28 @@ export default class implements Command {
|
||||||
|
|
||||||
const firstSong = newSongs[0];
|
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 !== '') {
|
if (extraMsg !== '') {
|
||||||
extraMsg = ` (${extraMsg})`;
|
extraMsg = ` (${extraMsg})`;
|
||||||
}
|
}
|
||||||
|
@ -156,19 +177,5 @@ export default class implements Command {
|
||||||
} else {
|
} else {
|
||||||
await res.stop(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${extraMsg}`);
|
await res.stop(`u betcha, **${firstSong.title}** and ${newSongs.length - 1} other songs were added to the queue${extraMsg}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.voiceConnection === null) {
|
|
||||||
await player.connect(targetVoiceChannel);
|
|
||||||
|
|
||||||
if (player.status === STATUS.PAUSED && queueOldSize) {
|
|
||||||
// Resume playing from queue after being paused
|
|
||||||
await player.play();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queueOldSize === 0 && !wasPlayingSong) {
|
|
||||||
// Only auto-play if queue was empty before and nothing was playing
|
|
||||||
await player.play();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,6 +235,10 @@ export default class {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns queue, not including the current song.
|
||||||
|
* @returns {QueuedSong[]}
|
||||||
|
*/
|
||||||
getQueue(): QueuedSong[] {
|
getQueue(): QueuedSong[] {
|
||||||
return this.queue.slice(this.queuePosition + 1);
|
return this.queue.slice(this.queuePosition + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue