فهرست منبع

add country flag

Daniel Gibbs 4 سال پیش
والد
کامیت
77e1ee16ac
3فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 1 1
      lgsm/functions/alert_discord.sh
  2. 0 1
      lgsm/functions/command_test_alert.sh
  3. 9 0
      lgsm/functions/info_distro.sh

+ 1 - 1
lgsm/functions/alert_discord.sh

@@ -45,7 +45,7 @@ json=$(cat <<EOF
 				},
 				},
 				{
 				{
 				"name": "Country",
 				"name": "Country",
-				"value": "${country}",
+				"value": "${countryflag} ${country}",
 				"inline": true
 				"inline": true
 				},
 				},
 				{
 				{

+ 0 - 1
lgsm/functions/command_test_alert.sh

@@ -12,7 +12,6 @@ fn_firstcommand_set
 
 
 fn_print_dots "${servername}"
 fn_print_dots "${servername}"
 check.sh
 check.sh
-info_game.sh
 alert="${userinput2}"
 alert="${userinput2}"
 if [ -z "${alert}" ]; then
 if [ -z "${alert}" ]; then
 	alert="test"
 	alert="test"

+ 9 - 0
lgsm/functions/info_distro.sh

@@ -256,6 +256,15 @@ if [ -z "${extip}" ]; then
 	ipapijson=$(curl --connect-timeout 10 -s http://ip-api.com/json)
 	ipapijson=$(curl --connect-timeout 10 -s http://ip-api.com/json)
 	extip="$(echo "${ipapijson}" | jq -r .query)"
 	extip="$(echo "${ipapijson}" | jq -r .query)"
 	country="$(echo "${ipapijson}" | jq -r .country)"
 	country="$(echo "${ipapijson}" | jq -r .country)"
+
+	if [ ! -f "${datadir}/emoji.json" ];then
+		fn_fetch_file "https://raw.githubusercontent.com/GameServerManagers/unicode-emoji-json/main/data-by-emoji.json" "${datadir}" "emoji.json"
+	fi
+
+	if [ -n "${country}" ]&&[ -f "${datadir}/emoji.json" ];then
+	 countryflag="$(jq -r --arg country "flag $country" 'to_entries[]| {"emoji": .key, "name": .value.name} | select(.name==$country)|.emoji' ${datadir}/emoji.json)"
+ 	fi
+
 	exitcode=$?
 	exitcode=$?
 	# Should ifconfig.co return an error will use last known IP.
 	# Should ifconfig.co return an error will use last known IP.
 	if [ ${exitcode} -eq 0 ]; then
 	if [ ${exitcode} -eq 0 ]; then