adds checkAlias option

This commit is contained in:
Pedro Ivo Hudson 2024-02-14 11:31:58 -03:00
parent c9d8e00139
commit 242a1f4035
3 changed files with 7 additions and 4 deletions

View File

@ -59,6 +59,7 @@ Confused on how this works, or you want to see more? Checkout the [examples](/ex
| **portCache** | boolean | true | After you queried a server, the second time you query that exact server (identified by specified ip and port), first add an attempt to query with the last successful port. |
| **noBreadthOrder** | boolean | false | Enable the behaviour of retrying an attempt X times followed by the next attempt X times, otherwise try attempt A, then B, then A, then B until reaching the X retry count of each. |
| **checkOldIDs** | boolean | false | Also checks the old ids amongst the current ones. |
| **checkAlias** | boolean | false | Also checks for alternative game ids. |
## Query Response

View File

@ -6,7 +6,7 @@ import Minimist from 'minimist'
import { GameDig } from './../lib/index.js'
const argv = Minimist(process.argv.slice(2), {
boolean: ['pretty', 'debug', 'givenPortOnly', 'requestRules', 'requestRulesRequired', 'requestPlayersRequired', 'stripColors', 'portCache', 'noBreadthOrder', 'checkOldIDs'],
boolean: ['pretty', 'debug', 'givenPortOnly', 'requestRules', 'requestRulesRequired', 'requestPlayersRequired', 'stripColors', 'portCache', 'noBreadthOrder', 'checkOldIDs', 'checkAlias'],
string: ['guildId', 'listenUdpPort', 'ipFamily', 'token'],
default: {
stripColors: true,

View File

@ -13,9 +13,11 @@ export const lookup = (options) => {
let game = games[type]
Object.keys(games).forEach((id) => {
if (games[id]?.extra?.alias) game = games[id]
})
if (options.checkAlias) {
Object.keys(games).forEach((id) => {
if (games[id]?.extra?.alias) game = games[id]
})
}
if (options.checkOldIDs) {
Object.keys(games).forEach((id) => {