music: generate random ids for queue items
This commit is contained in:
parent
7f8ca1e532
commit
bf5a6df175
1 changed files with 3 additions and 2 deletions
|
@ -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).`;
|
||||
|
|
Loading…
Reference in a new issue