Browse Source

feat: update gamedig cli commands

will speed up querying of servers
pull/4206/head
Daniel Gibbs 2 years ago
parent
commit
2dda129508
  1. 11
      lgsm/modules/query_gamedig.sh

11
lgsm/modules/query_gamedig.sh

@ -7,6 +7,7 @@
# https://github.com/sonicsnes/node-gamedig # https://github.com/sonicsnes/node-gamedig
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
# Default query status to failure. Will be changed to 0 if query is successful.
querystatus="2" querystatus="2"
# Check if gamedig and jq are installed. # Check if gamedig and jq are installed.
if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
@ -19,16 +20,10 @@ if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)"
queryport="${port}" queryport="${port}"
fi fi
# checks if query is working null = pass. # checks if query is working null = pass.
gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${queryip}\" --query_port \"${queryport}\"|jq") gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" \"${queryip}:${queryport}\"|jq")
gamedigraw=$(gamedig --type "${querytype}" --host "${queryip}" --query_port "${queryport}") gamedigraw=$(gamedig --type "${querytype}" "${queryip}:${queryport}")
querystatus=$(echo "${gamedigraw}" | jq '.error|length') querystatus=$(echo "${gamedigraw}" | jq '.error|length')
if [ "${querystatus}" != "null" ]; then
gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${queryip}\" --port \"${queryport}\"|jq")
gamedigraw=$(gamedig --type "${querytype}" --host "${queryip}" --port "${queryport}")
querystatus=$(echo "${gamedigraw}" | jq '.error|length')
fi
if [ "${querytype}" == "teamspeak3" ]; then if [ "${querytype}" == "teamspeak3" ]; then
fn_info_game_ts3 fn_info_game_ts3
fi fi

Loading…
Cancel
Save