presence: modernize listening bar
This commit is contained in:
		
							parent
							
								
									fddf5047cd
								
							
						
					
					
						commit
						b9292504dc
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -18,7 +18,7 @@ const HangStatusImages = {};
 | 
			
		|||
  }
 | 
			
		||||
})();
 | 
			
		||||
 | 
			
		||||
const NOWPLAYING_BAR_LENGTH = 30;
 | 
			
		||||
const NOWPLAYING_BAR_LENGTH = 32;
 | 
			
		||||
 | 
			
		||||
function fixMediaProxyURL(url) {
 | 
			
		||||
  if (url.includes("media.discordapp.net")) {
 | 
			
		||||
| 
						 | 
				
			
			@ -193,10 +193,12 @@ presence.callback = async function (msg, line) {
 | 
			
		|||
            const progress = position >= length ? 1 : position / length;
 | 
			
		||||
            const barLength = Math.round(progress * NOWPLAYING_BAR_LENGTH);
 | 
			
		||||
 | 
			
		||||
            const bar = `\`[${"=".repeat(barLength)}${" ".repeat(NOWPLAYING_BAR_LENGTH - barLength)}]\``;
 | 
			
		||||
            const time = `\`${timePos}${" ".repeat(
 | 
			
		||||
              NOWPLAYING_BAR_LENGTH + 2 - timePos.length - timeEnd.length
 | 
			
		||||
            )}${timeEnd}\``;
 | 
			
		||||
            const bar = `\`\`\`ansi\n${"\u2014".repeat(barLength)}\x1b[30m${"\u2014".repeat(
 | 
			
		||||
              NOWPLAYING_BAR_LENGTH - barLength
 | 
			
		||||
            )}\x1b[39m`;
 | 
			
		||||
            const time = `${timePos}${" ".repeat(
 | 
			
		||||
              NOWPLAYING_BAR_LENGTH - timePos.length - timeEnd.length
 | 
			
		||||
            )}${timeEnd}\`\`\``;
 | 
			
		||||
 | 
			
		||||
            descLines.push(bar);
 | 
			
		||||
            descLines.push(time);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue