Print a message showing zero players when no players are online
This commit is contained in:
		
							parent
							
								
									139e8dcfca
								
							
						
					
					
						commit
						9e2191a199
					
				
							
								
								
									
										4
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								index.js
									
									
									
									
									
								
							| 
						 | 
				
			
			@ -30,7 +30,6 @@ function sendOnline(status, channel) {
 | 
			
		|||
            embed.addField("**" + status[s].name + "**:", status[s].players.join(', '), false);
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    if ( playerCount == 0 ) return;
 | 
			
		||||
    embed.setTitle("**Players Currently Online:** " + playerCount);
 | 
			
		||||
    channel.send(embed);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -57,6 +56,7 @@ client.on('message', async msg => {
 | 
			
		|||
            }
 | 
			
		||||
        });
 | 
			
		||||
        Servers.forEach(function (server) {
 | 
			
		||||
            if ( !status[server.slug] ) return;
 | 
			
		||||
            const q = new Query({host: server.rconAddress, port: server.queryPort, timeout: 250});
 | 
			
		||||
            try {
 | 
			
		||||
                q.fullStat()
 | 
			
		||||
| 
						 | 
				
			
			@ -69,6 +69,8 @@ client.on('message', async msg => {
 | 
			
		|||
                    .then(() => { q.close(); })
 | 
			
		||||
                    .catch(e => {
 | 
			
		||||
                        q.close();
 | 
			
		||||
                        console.log("slug: " + server.slug);
 | 
			
		||||
                        console.log(status);
 | 
			
		||||
                        status[server.slug].tested = true;
 | 
			
		||||
                        sendOnline(status, msg.channel);
 | 
			
		||||
                    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user