From 53cd705bde65ea092642e437f95ba39ec087eac8 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Mon, 16 Mar 2020 12:01:22 -0500 Subject: [PATCH] Allow skipping past current song in empty queue --- src/commands/skip.ts | 7 ++++++- src/services/queue.ts | 4 ++++ src/utils/loading-message.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/commands/skip.ts b/src/commands/skip.ts index 87fb94d..ec0e83e 100644 --- a/src/commands/skip.ts +++ b/src/commands/skip.ts @@ -23,10 +23,15 @@ export default class implements Command { try { queue.forward(); - await this.playerManager.get(msg.guild!.id).play(); + if (queue.isEmpty()) { + this.playerManager.get(msg.guild!.id).disconnect(); + } else { + await this.playerManager.get(msg.guild!.id).play(); + } await msg.channel.send('keepin\' \'er movin\''); } catch (_) { + console.log(_); await msg.channel.send('no song to skip to'); } } diff --git a/src/services/queue.ts b/src/services/queue.ts index ffc16ae..c929eea 100644 --- a/src/services/queue.ts +++ b/src/services/queue.ts @@ -78,4 +78,8 @@ export default class { size(): number { return this.queue.length; } + + isEmpty(): boolean { + return this.get().length === 0; + } } diff --git a/src/utils/loading-message.ts b/src/utils/loading-message.ts index 9773c03..3d24905 100644 --- a/src/utils/loading-message.ts +++ b/src/utils/loading-message.ts @@ -17,7 +17,7 @@ export default class { const period = 500; - const icons = ['⚪', '🔵', '⚫']; + const icons = ['🐮', '🐴', '🐄']; const reactions = [];