aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2021-09-18 16:55:50 -0400
committerMax Isom <[email protected]>2021-09-18 16:55:50 -0400
commit9a2ef876d381a646f0d66145d8ed3cfa8da7fac3 (patch)
tree8b801cd52206dab815625c7a42a36a31c3601769 /src/commands
parent81bbdb971d4221063b16fc2150ed9f4c56041765 (diff)
downloadmuse-9a2ef876d381a646f0d66145d8ed3cfa8da7fac3.tar.xz
muse-9a2ef876d381a646f0d66145d8ed3cfa8da7fac3.zip
Correctly skip song if unavailable
Also lets user know in text channel that song is unavailable after skipping. Fixes #324
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/play.ts5
1 files changed, 3 insertions, 2 deletions
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<Except<QueuedSong, 'addedInChannelId'>> = [];
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];