music: fix now playing bar for streams
This commit is contained in:
		
							parent
							
								
									484fd1aa10
								
							
						
					
					
						commit
						5b07c150dc
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
					@ -359,9 +359,7 @@ async function enqueue({
 | 
				
			||||||
      return;
 | 
					      return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    console.log(media);
 | 
					 | 
				
			||||||
    const resource = createAudioResource(media.stream, {inputType: media.type});
 | 
					    const resource = createAudioResource(media.stream, {inputType: media.type});
 | 
				
			||||||
    console.log(resource);
 | 
					 | 
				
			||||||
    connection.player.play(resource);
 | 
					    connection.player.play(resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    textChannel.createMessage({
 | 
					    textChannel.createMessage({
 | 
				
			||||||
| 
						 | 
					@ -649,10 +647,10 @@ command.callback = async function (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const position = Date.now() - nowPlaying.start;
 | 
					      const position = Date.now() - nowPlaying.start;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const timeEnd = formatTime(nowPlaying.length);
 | 
					      const timeEnd = nowPlaying.length == 0 ? "\u221e" : formatTime(nowPlaying.length);
 | 
				
			||||||
      const timePos = formatTime(position);
 | 
					      const timePos = formatTime(position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const progress = position / nowPlaying.length;
 | 
					      const progress = nowPlaying.length == 0 ? 1 : position / nowPlaying.length;
 | 
				
			||||||
      const barLength = Math.round(progress * NOWPLAYING_BAR_LENGTH);
 | 
					      const barLength = Math.round(progress * NOWPLAYING_BAR_LENGTH);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const bar = `\`[${"=".repeat(barLength)}${" ".repeat(
 | 
					      const bar = `\`[${"=".repeat(barLength)}${" ".repeat(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue