2020-04-30 04:06:09 +00:00
const { getGuild } = require ( '../modules/music' )
2020-01-25 10:02:43 +00:00
module . exports . run = ( client , message , args , level ) => {
2020-04-30 04:06:09 +00:00
var queue = getGuild ( message . guild . id ) . queue
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
if ( queue . length < 2 ) {
return message . channel . send ( '<:error:466995152976871434> Not enough songs are in the queue for this command to work!' )
2020-01-25 10:02:43 +00:00
}
2020-04-30 04:06:09 +00:00
if ( ! args [ 0 ] ) {
return message . channel . send ( ` <:error:466995152976871434> You didn't tell me what song to remove! Usage: \` ${ client . commands . get ( 'removesong' ) . help . usage } \` ` )
}
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
var input = + args [ 0 ]
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
if ( isNaN ( input ) === true ) {
return message . channel . send ( '<:error:466995152976871434> That isn\'t a number! You need to tell me the songs position in the queue (1, 2, etc.)' )
}
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
if ( input >= queue . length || input < 1 ) {
return message . channel . send ( '<:error:466995152976871434> Input is not a valid song ID.' )
}
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
var songName = queue [ input ] . video . title
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
queue . splice ( input , 1 )
2020-01-25 10:02:43 +00:00
2020-04-30 04:06:09 +00:00
message . channel . send ( ` <:success:466995111885144095> Removed from queue: ** ${ songName } ** ` )
2020-01-25 10:02:43 +00:00
} ;
exports . conf = {
enabled : true ,
guildOnly : true ,
aliases : [ "rmsong" ] ,
permLevel : "Moderator" ,
2020-04-30 04:06:09 +00:00
requiredPerms : [ ]
2020-01-25 10:02:43 +00:00
} ;
exports . help = {
name : "removesong" ,
category : "Music" ,
description : "Removes the specified song from the queue." ,
usage : "removesong [position]"
} ;