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,
 | 
					      length,
 | 
				
			||||||
      addedBy,
 | 
					      addedBy,
 | 
				
			||||||
      stream,
 | 
					      stream,
 | 
				
			||||||
 | 
					      id: Math.random().toString(16).substring(2),
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    if (suppress === false) {
 | 
					    if (suppress === false) {
 | 
				
			||||||
      textChannel.createMessage({
 | 
					      textChannel.createMessage({
 | 
				
			||||||
| 
						 | 
					@ -687,7 +688,7 @@ command.callback = async function (msg, line) {
 | 
				
			||||||
          queue.slice(0, 25).map((item) => {
 | 
					          queue.slice(0, 25).map((item) => {
 | 
				
			||||||
            const user = hf.bot.users.get(item.addedBy);
 | 
					            const user = hf.bot.users.get(item.addedBy);
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
              key: item.url.substring(0, 100),
 | 
					              key: item.id,
 | 
				
			||||||
              display: (item.title ?? item.url).substr(0, 100),
 | 
					              display: (item.title ?? item.url).substr(0, 100),
 | 
				
			||||||
              description:
 | 
					              description:
 | 
				
			||||||
                hasManageMessages &&
 | 
					                hasManageMessages &&
 | 
				
			||||||
| 
						 | 
					@ -701,7 +702,7 @@ command.callback = async function (msg, line) {
 | 
				
			||||||
        if (Array.isArray(toRemove)) {
 | 
					        if (Array.isArray(toRemove)) {
 | 
				
			||||||
          for (const removedItem of toRemove) {
 | 
					          for (const removedItem of toRemove) {
 | 
				
			||||||
            connection._music_queue = connection._music_queue.filter(
 | 
					            connection._music_queue = connection._music_queue.filter(
 | 
				
			||||||
              (item) => !item.url.startsWith(removedItem)
 | 
					              (item) => item.id !== removedItem
 | 
				
			||||||
            );
 | 
					            );
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          return `Removed ${toRemove.length} item(s).`;
 | 
					          return `Removed ${toRemove.length} item(s).`;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue