mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-18 01:30:39 +01:00
feat: Use async/await on attempt_protocols
This commit is contained in:
parent
c264138e54
commit
c49d463858
1 changed files with 16 additions and 13 deletions
|
@ -17,17 +17,20 @@ const gamedig = new GameDig(options)
|
|||
|
||||
const protocols = ['valve', 'gamespy1', 'gamespy2', 'gamespy3', 'goldsrc', 'minecraft', 'quake1', 'quake2', 'quake3', 'unreal2', 'valve']
|
||||
|
||||
protocols.forEach(protocol => {
|
||||
gamedig.query({
|
||||
const run = async () => {
|
||||
for (const protocol of protocols) {
|
||||
try {
|
||||
const response = await gamedig.query({
|
||||
...options,
|
||||
debug: true,
|
||||
type: `protocol-${protocol}`
|
||||
})
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
console.log(response)
|
||||
process.exit()
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(`Error on '${protocol}': ${error}`)
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(`Error on '${protocol}': ${e}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run().then(() => {})
|
||||
|
|
Loading…
Reference in a new issue