music: generate random ids for queue items

This commit is contained in:
Cynthia Foxwell 2022-04-24 13:09:00 -06:00
parent 7f8ca1e532
commit bf5a6df175

View file

@ -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).`;