From 7c23e6c9e49de1ae2fe6044a55c5f5a48f89c134 Mon Sep 17 00:00:00 2001 From: Pedro Ivo Hudson Date: Wed, 17 Jan 2024 08:07:30 -0300 Subject: [PATCH] feat(tools/attempt): test against all protocols (#475) * feat: get protocol list from /protocols * simpler way to call protocols * adds a services filter --- tools/attempt_protocols.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/attempt_protocols.js b/tools/attempt_protocols.js index 15960ad..13cc6fb 100644 --- a/tools/attempt_protocols.js +++ b/tools/attempt_protocols.js @@ -1,5 +1,6 @@ import Minimist from 'minimist' import { GameDig } from './../lib/index.js' +import * as protocols from './../protocols/index.js' const argv = Minimist(process.argv.slice(2), {}) @@ -15,10 +16,15 @@ if (argv._.length >= 1) { const gamedig = new GameDig(options) -const protocols = ['valve', 'gamespy1', 'gamespy2', 'gamespy3', 'goldsrc', 'minecraft', 'quake1', 'quake2', 'quake3', 'unreal2', 'valve'] +let protocolList = [] +Object.keys(protocols).forEach((key) => protocolList.push(key)) + +const services = ['discord', 'beammpmaster', 'beammp', 'teamspeak2', 'teamspeak3'] +const protocolListFiltered = protocolList.filter((protocol) => !services.includes(protocol)) + const run = async () => { - for (const protocol of protocols) { + for (const protocol of protocolListFiltered) { try { const response = await gamedig.query({ ...options,