music.play: add --next

This commit is contained in:
Cynthia Foxwell 2022-05-04 15:46:29 -06:00
parent 3897182797
commit a29283721d

View file

@ -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 {