diff --git a/src/modules/music.js b/src/modules/music.js index 5222367..8daf39d 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -176,7 +176,8 @@ async function enqueue( url, type, addedBy, - suppress = false + suppress = false, + queueNext = false ) { if (!url) return; @@ -258,7 +259,7 @@ async function enqueue( } if (connection.playing) { - connection._music_queue.push({ + const queueItem = { url, type, title, @@ -266,12 +267,21 @@ async function enqueue( addedBy, stream, id: Math.random().toString(16).substring(2), - }); + }; + + if (queueNext === true) { + connection._music_queue.splice(0, 0, queueItem); + } else { + connection._music_queue.push(queueItem); + } + if (suppress === false) { textChannel.createMessage({ embeds: [ { - title: `<:ms_tick:503341995348066313> Added to queue`, + title: `<:ms_tick:503341995348066313> Added to queue ${ + queueNext === true ? "(next up)" : "" + }`, color: 0x00cc00, fields: [ { @@ -423,6 +433,12 @@ command.callback = async function (msg, line) { argStr = argStr.replace(/--offset=(\d+)/, "").trim(); } + let queueNext = false; + if (argStr.match(/--next/)) { + queueNext = true; + argStr = argStr.replace(/--next/, "").trim(); + } + let type; let playlist = false; @@ -516,7 +532,9 @@ command.callback = async function (msg, line) { msg.channel.id, argStr, type, - msg.author.id + msg.author.id, + false, + queueNext ); } } else {