From bf5a6df175ef6877262b94bc50699e1d04caec84 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Sun, 24 Apr 2022 13:09:00 -0600 Subject: [PATCH] music: generate random ids for queue items --- src/modules/music.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/music.js b/src/modules/music.js index 3cbc781..14f278e 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -265,6 +265,7 @@ async function enqueue( length, addedBy, stream, + id: Math.random().toString(16).substring(2), }); if (suppress === false) { textChannel.createMessage({ @@ -687,7 +688,7 @@ command.callback = async function (msg, line) { queue.slice(0, 25).map((item) => { const user = hf.bot.users.get(item.addedBy); return { - key: item.url.substring(0, 100), + key: item.id, display: (item.title ?? item.url).substr(0, 100), description: hasManageMessages && @@ -701,7 +702,7 @@ command.callback = async function (msg, line) { if (Array.isArray(toRemove)) { for (const removedItem of toRemove) { connection._music_queue = connection._music_queue.filter( - (item) => !item.url.startsWith(removedItem) + (item) => item.id !== removedItem ); } return `Removed ${toRemove.length} item(s).`;