mirror of
https://github.com/Sithranduil/srcds_exporter.git
synced 2025-07-23 17:28:00 +02:00
Ajout du support de gametracker
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { TimeoutError } from 'working-rcon';
|
||||
import got from 'got';
|
||||
import jsdom from 'jsdom';
|
||||
|
||||
export default {
|
||||
parseCvar(value) {
|
||||
@@ -14,6 +16,10 @@ export default {
|
||||
getLine(value, line = 1) {
|
||||
return value.split('\n', line)[line - 1];
|
||||
},
|
||||
searchLine(value, stringToSearch) {
|
||||
const lines = value.split('\n');
|
||||
return lines.filter((line) => line.includes(stringToSearch));
|
||||
},
|
||||
async rconCommand(client, command) {
|
||||
try {
|
||||
return client.command(command);
|
||||
@@ -29,4 +35,8 @@ export default {
|
||||
isValidResponse(response) {
|
||||
return !response.includes('Unknown');
|
||||
},
|
||||
async requestGameTracker(ip, port) {
|
||||
const response = await got(`https://www.gametracker.com/server_info/${ip}:${port}`);
|
||||
return new jsdom.JSDOM(response.body);
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user