mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-11 12:21:37 +02:00
Correctly skip song if unavailable
Also lets user know in text channel that song is unavailable after skipping. Fixes #324
This commit is contained in:
parent
81bbdb971d
commit
9a2ef876d3
6 changed files with 66 additions and 19 deletions
|
@ -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];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue