Add pause/resume

This commit is contained in:
Max Isom 2020-03-15 19:30:07 -05:00
parent e55acbb718
commit 2875c6ceb8
4 changed files with 123 additions and 26 deletions
src/commands

View file

@ -36,6 +36,29 @@ export default class implements Command {
}
public async execute(msg: Message, args: string []): Promise<void> {
const queue = this.queueManager.get(msg.guild!.id);
if (args.length === 0) {
if (this.playerManager.get(msg.guild!.id).status === STATUS.PLAYING) {
await msg.channel.send('error: already playing, give me a song name');
return;
}
// Must be resuming play
if (queue.get().length === 0) {
await msg.channel.send('error: nothing to play');
return;
}
const channel = getMostPopularVoiceChannel(msg.guild!);
await this.playerManager.get(msg.guild!.id).connect(channel);
await this.playerManager.get(msg.guild!.id).play();
await msg.channel.send('play resuming');
return;
}
const newSongs: QueuedSong[] = [];
const res = new LoadingMessage(msg.channel as TextChannel, 'hold on a sec');