misc.mcserver: fix motd for some (older) servers
This commit is contained in:
		
							parent
							
								
									d4f504bb3a
								
							
						
					
					
						commit
						fcb1b770ea
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -239,7 +239,11 @@ mcserver.callback = async function (msg, line) {
 | 
			
		|||
 | 
			
		||||
    await msg.removeReaction("\uD83C\uDFD3");
 | 
			
		||||
 | 
			
		||||
    const motd = data.description.text.replace(/\u00a7([a-f0-9k-or])/gi, (formatting) => {
 | 
			
		||||
    const desc =
 | 
			
		||||
      typeof data.description == "string"
 | 
			
		||||
        ? data.description
 | 
			
		||||
        : data.description?.text ?? "<server didn't properly send motd>";
 | 
			
		||||
    const motd = desc.replace(/\u00a7([a-f0-9k-or])/gi, (formatting) => {
 | 
			
		||||
      const ansi = formattingToAnsi[formatting];
 | 
			
		||||
      return ansi ? `\x1b[${ansi}m` : "";
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue