From 9a2ef876d381a646f0d66145d8ed3cfa8da7fac3 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 18 Sep 2021 16:55:50 -0400 Subject: Correctly skip song if unavailable Also lets user know in text channel that song is unavailable after skipping. Fixes #324 --- src/commands/play.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/commands') diff --git a/src/commands/play.ts b/src/commands/play.ts index a67b318..4886da2 100644 --- a/src/commands/play.ts +++ b/src/commands/play.ts @@ -1,5 +1,6 @@ import {TextChannel, Message} from 'discord.js'; import {URL} from 'url'; +import {Except} from 'type-fest'; import {TYPES} from '../types'; import {inject, injectable} from 'inversify'; import {QueuedSong, STATUS} from '../services/player'; @@ -68,7 +69,7 @@ export default class implements Command { const addToFrontOfQueue = args[args.length - 1] === 'i' || args[args.length - 1] === 'immediate'; - const newSongs: QueuedSong[] = []; + const newSongs: Array> = []; let extraMsg = ''; // Test if it's a complete URL @@ -133,7 +134,7 @@ export default class implements Command { return; } - newSongs.forEach(song => player.add(song, {immediate: addToFrontOfQueue})); + newSongs.forEach(song => player.add({...song, addedInChannelId: msg.channel.id}, {immediate: addToFrontOfQueue})); const firstSong = newSongs[0]; -- cgit v1.2.3