feat(tools/attempt): test against all protocols (#475)

* feat: get protocol list from /protocols

* simpler way to call protocols

* adds a services filter
This commit is contained in:
Pedro Ivo Hudson 2024-01-17 08:07:30 -03:00 committed by GitHub
parent b481425dbf
commit 7c23e6c9e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -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,