feat: Use async/await on attempt_protocols

This commit is contained in:
CosminPerRam 2023-11-05 23:50:43 +02:00
parent c264138e54
commit c49d463858

View file

@ -17,17 +17,20 @@ const gamedig = new GameDig(options)
const protocols = ['valve', 'gamespy1', 'gamespy2', 'gamespy3', 'goldsrc', 'minecraft', 'quake1', 'quake2', 'quake3', 'unreal2', 'valve'] const protocols = ['valve', 'gamespy1', 'gamespy2', 'gamespy3', 'goldsrc', 'minecraft', 'quake1', 'quake2', 'quake3', 'unreal2', 'valve']
protocols.forEach(protocol => { const run = async () => {
gamedig.query({ for (const protocol of protocols) {
...options, try {
debug: true, const response = await gamedig.query({
type: `protocol-${protocol}` ...options,
}) debug: true,
.then(data => { type: `protocol-${protocol}`
console.log(data) })
console.log(response)
process.exit() process.exit()
}) } catch (e) {
.catch(error => { console.log(`Error on '${protocol}': ${e}`)
console.log(`Error on '${protocol}': ${error}`) }
}) }
}) }
run().then(() => {})