diff --git a/lgsm/modules/alert_discord.sh b/lgsm/modules/alert_discord.sh
index 93eda8d5bd..78e0293493 100644
--- a/lgsm/modules/alert_discord.sh
+++ b/lgsm/modules/alert_discord.sh
@@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"username": "LinuxGSM",
@@ -29,103 +29,32 @@ jsoninfo=$(
"url": "${alerticon}"
},
"fields": [
- {
- "name": "Server Name",
- "value": "${servername}"
- },
- {
- "name": "Information",
- "value": "${alertmessage}"
- },
{
- "name": "Game",
- "value": "${gamename}",
- "inline": true
+ "name": "Server Name",
+ "value": "${servername}"
},
{
- "name": "Server IP",
- "value": "\`${alertip}:${port}\`",
- "inline": true
- },
- {
- "name": "Hostname",
- "value": "${HOSTNAME}",
- "inline": true
+ "name": "Information",
+ "value": "${alertmessage}"
},
- {
- "name": "More info",
- "value": "${alerturl}",
- "inline": true
- },
- {
- "name": "Server Time",
- "value": "$(date)",
- "inline": true
- }
- ],
- "footer": {
- "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
- "text": "Sent by LinuxGSM ${version}"
- }
- }
- ]
-}
-EOF
-)
-
-jsonnoinfo=$(
- cat << EOF
-{
- "username": "LinuxGSM",
- "avatar_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
- "file": "content",
- "embeds": [
- {
- "author": {
- "name": "LinuxGSM Alert",
- "url": "",
- "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg"
- },
- "title": "${alerttitle}",
- "url": "",
- "description": "",
- "color": "${alertcolourdec}",
- "type": "content",
- "thumbnail": {
- "url": "${alerticon}"
- },
- "fields": [
- {
- "name": "Server Name",
- "value": "${servername}"
- },
- {
- "name": "Information",
- "value": "${alertmessage}"
- },
{
"name": "Game",
"value": "${gamename}",
"inline": true
},
{
- "name": "Server IP",
- "value": "\`${alertip}:${port}\`",
- "inline": true
- },
- {
- "name": "Hostname",
- "value": "${HOSTNAME}",
+ "name": "Server Time",
+ "value": "$(date)",
"inline": true
},
{
- "name": "Server Time",
- "value": "$(date)",
+ "name": "Is my Game Server Online?",
+ "value": "https://ismygameserver.online/${querytype}/${alertip}:${queryport}",
"inline": true
}
],
"footer": {
- "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
+ "icon_url": "https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/lgsm/data/alert_discord_logo.jpg",
"text": "Sent by LinuxGSM ${version}"
}
}
@@ -136,12 +65,6 @@ EOF
fn_print_dots "Sending Discord alert"
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
discordsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${discordwebhook}")
if [ -n "${discordsend}" ]; then
diff --git a/lgsm/modules/alert_gotify.sh b/lgsm/modules/alert_gotify.sh
index dcb438fb2e..b460aa794a 100644
--- a/lgsm/modules/alert_gotify.sh
+++ b/lgsm/modules/alert_gotify.sh
@@ -7,32 +7,38 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"title": "${alerttitle}",
- "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)",
- "priority": 5
-}
+ "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
EOF
)
-jsonnoinfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+Is my Game Server Online?\nhttps://ismygameserver.online/${querytype}/${alertip}:${queryport}\n\n
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+More info\n${alerturl}\n\n
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
-{
- "title": "${alerttitle}",
- "message": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)",
+Server Time\n$(date)",
"priority": 5
}
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending Gotify alert"
gotifysend=$(curl --connect-timeout 3 -sSL "${gotifywebhook}/message"?token="${gotifytoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)")
diff --git a/lgsm/modules/alert_ifttt.sh b/lgsm/modules/alert_ifttt.sh
index ca1c005d0d..16d78c807f 100644
--- a/lgsm/modules/alert_ifttt.sh
+++ b/lgsm/modules/alert_ifttt.sh
@@ -7,32 +7,38 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"value1": "${selfname}",
"value2": "${alerttitle}",
- "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)"
-}
+ "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
EOF
)
-jsonnoinfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+Is my Game Server Online?\nhttps://ismygameserver.online/${querytype}/${alertip}:${queryport}\n\n
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+More info\n${alerturl}\n\n
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
-{
- "value1": "${selfname}",
- "value2": "${alerttitle}",
- "value3": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)"
+Server Time\n$(date)"
}
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending IFTTT alert"
iftttsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://maker.ifttt.com/trigger/${iftttevent}/with/key/${ifttttoken}" | grep "Bad Request")
diff --git a/lgsm/modules/alert_pushbullet.sh b/lgsm/modules/alert_pushbullet.sh
index 4b96a1f9fe..10407026f6 100644
--- a/lgsm/modules/alert_pushbullet.sh
+++ b/lgsm/modules/alert_pushbullet.sh
@@ -7,34 +7,39 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"channel_tag": "${channeltag}",
"type": "note",
"title": "${alerttitle}",
- "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)"
-}
+ "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
EOF
)
-jsonnoinfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+Is my Game Server Online?\nhttps://ismygameserver.online/${querytype}/${alertip}:${queryport}\n\n
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+More info\n${alerturl}\n\n
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
-{
- "channel_tag": "${channeltag}",
- "type": "note",
- "title": "${alerttitle}",
- "body": "Server Name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)"
+Server Time\n$(date)"
}
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending Pushbullet alert"
pushbulletsend=$(curl --connect-timeout 3 -sSL -H "Access-Token: ${pushbullettoken}" -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "https://api.pushbullet.com/v2/pushes" | grep "error_code")
diff --git a/lgsm/modules/alert_pushover.sh b/lgsm/modules/alert_pushover.sh
index dc488026af..6c0dbdbc94 100644
--- a/lgsm/modules/alert_pushover.sh
+++ b/lgsm/modules/alert_pushover.sh
@@ -22,12 +22,28 @@ else
alertpriority="0"
fi
-if [ -z "${alerturl}" ]; then
- pushoversend=$(curl --connect-timeout 3 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" Server name
${servername}
Information
${alertmessage}
Game
${gamename}
Server IP
${alertip}:${port}
Hostname
${HOSTNAME}
Server Time
$(date)" "https://api.pushover.net/1/messages.json" | grep errors)
-else
- pushoversend=$(curl --connect-timeout 3 -sS -F token="${pushovertoken}" -F user="${pushoveruserkey}" -F html="1" -F sound="${alertsound}" -F priority="${alertpriority}" -F title="${alerttitle}" -F message=" Server name
${servername}
Information
${alertmessage}
Game
${gamename}
Server IP
${alertip}:${port}
Hostname
${HOSTNAME}
More info
${alerturl}
Server Time
$(date)" "https://api.pushover.net/1/messages.json" | grep errors)
+message=" Server name
${servername}
Information
${alertmessage}
Game
${gamename}
Server IP
${alertip}:${port}
Hostname
${HOSTNAME}
"
+
+if [ -n "${querytype}" ]; then
+ message+="Is my Game Server Online?
Check here
"
+fi
+
+if [ -n "${alerturl}" ]; then
+ message+="More info
${alerturl}
"
fi
+message+="Server Time
$(date)"
+
+pushoversend=$(curl --connect-timeout 3 -sS \
+ -F token="${pushovertoken}" \
+ -F user="${pushoveruserkey}" \
+ -F html="1" \
+ -F sound="${alertsound}" \
+ -F priority="${alertpriority}" \
+ -F title="${alerttitle}" \
+ -F message="${message}" \
+ "https://api.pushover.net/1/messages.json" | grep errors)
+
if [ -n "${pushoversend}" ]; then
fn_print_fail_nl "Sending Pushover alert: ${pushoversend}"
fn_script_log_fail "Sending Pushover alert: ${pushoversend}"
diff --git a/lgsm/modules/alert_rocketchat.sh b/lgsm/modules/alert_rocketchat.sh
index bff2c6a0ba..7d9b67e66d 100644
--- a/lgsm/modules/alert_rocketchat.sh
+++ b/lgsm/modules/alert_rocketchat.sh
@@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"alias": "LinuxGSM",
@@ -64,7 +64,31 @@ jsoninfo=$(
EOF
)
-jsonnoinfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+ {
+ "short": false,
+ "title": "Is my Game Server Online?",
+ "value": ""
+ },
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+ {
+ "short": false,
+ "title": "More info",
+ "value": "${alerturl}"
+ },
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
{
"alias": "LinuxGSM",
@@ -116,12 +140,6 @@ jsonnoinfo=$(
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending Rocketchat alert"
rocketchatsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${rocketchatwebhook}")
diff --git a/lgsm/modules/alert_slack.sh b/lgsm/modules/alert_slack.sh
index 58dc547724..15e7d5036e 100644
--- a/lgsm/modules/alert_slack.sh
+++ b/lgsm/modules/alert_slack.sh
@@ -7,7 +7,7 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsonnoinfo=$(
+json=$(
cat << EOF
{
"attachments": [
@@ -87,7 +87,35 @@ jsonnoinfo=$(
EOF
)
-jsoninfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": "*Is my Game Server Online?*\n"
+ }
+ },
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+ {
+ "type": "section",
+ "text": {
+ "type": "mrkdwn",
+ "text": "*More info*\n<${alerturl}|${alerturl}>"
+ }
+ },
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
{
"attachments": [
@@ -174,12 +202,6 @@ jsoninfo=$(
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending Slack alert"
slacksend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" "${slackwebhook}")
diff --git a/lgsm/modules/alert_telegram.sh b/lgsm/modules/alert_telegram.sh
index 2e719dba77..138b4b3f67 100644
--- a/lgsm/modules/alert_telegram.sh
+++ b/lgsm/modules/alert_telegram.sh
@@ -7,38 +7,41 @@
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-jsoninfo=$(
+json=$(
cat << EOF
{
"chat_id": "${telegramchatid}",
"message_thread_id": "${telegramthreadid}",
"parse_mode": "HTML",
"disable_notification": "${telegramdisablenotification}",
- "text": "${alerttitle}\n\nServer name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nMore info\n${alerturl}\n\nServer Time\n$(date)",
- "disable_web_page_preview": "yes"
-}
+ "text": "${alerttitle}\n\nServer name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\n
EOF
)
-jsonnoinfo=$(
+if [ -n "${querytype}" ]; then
+ json+=$(
+ cat << EOF
+Is my Game Server Online?\nCheck here\n\n
+EOF
+ )
+fi
+
+if [ -n "${alerturl}" ]; then
+ json+=$(
+ cat << EOF
+More info\n${alerturl}\n\n
+EOF
+ )
+fi
+
+json+=$(
cat << EOF
-{
- "chat_id": "${telegramchatid}",
- "message_thread_id": "${telegramthreadid}",
- "parse_mode": "HTML",
- "disable_notification": "${telegramdisablenotification}",
- "text": "${alerttitle}\n\nServer name\n${servername}\n\nInformation\n${alertmessage}\n\nGame\n${gamename}\n\nServer IP\n${alertip}:${port}\n\nHostname\n${HOSTNAME}\n\nServer Time\n$(date)",
+Server Time\n$(date)",
"disable_web_page_preview": "yes"
}
EOF
)
-if [ -z "${alerturl}" ]; then
- json="${jsonnoinfo}"
-else
- json="${jsoninfo}"
-fi
-
fn_print_dots "Sending Telegram alert"
telegramsend=$(curl --connect-timeout 3 -sSL -H "Content-Type: application/json" -X POST -d "$(echo -n "${json}" | jq -c .)" ${curlcustomstring} "https://${telegramapi}/bot${telegramtoken}/sendMessage" | grep "error_code")
diff --git a/lgsm/modules/check_permissions.sh b/lgsm/modules/check_permissions.sh
index 9ed1bb65e9..4004732f2c 100644
--- a/lgsm/modules/check_permissions.sh
+++ b/lgsm/modules/check_permissions.sh
@@ -63,8 +63,8 @@ fn_check_permissions() {
findnotexecutable="$(find "${modulesdir}" -type f -not -executable)"
findnotexecutablewc="$(find "${modulesdir}" -type f -not -executable | wc -l)"
if [ "${findnotexecutablewc}" -ne "0" ]; then
- fn_print_fail_nl "Permissions issues found"
- fn_script_log_fail "Permissions issues found"
+ fn_print_error_nl "Permissions issues found"
+ fn_script_log_error "Permissions issues found"
fn_print_information_nl "The following files are not executable:"
fn_script_log_info "The following files are not executable:"
{
diff --git a/lgsm/modules/command_dev_query_raw.sh b/lgsm/modules/command_dev_query_raw.sh
index ebe54c40fd..62213ab60e 100644
--- a/lgsm/modules/command_dev_query_raw.sh
+++ b/lgsm/modules/command_dev_query_raw.sh
@@ -208,6 +208,10 @@ echo -e ""
echo -e "PORT: ${port}"
echo -e "QUERY PORT: ${queryport}"
echo -e ""
+echo -e "${lightgreen}Is My Game Server Online?${default}"
+fn_messages_separator
+echo -e "Game server status: https://ismygameserver.online/${querytype}/${queryip}:${queryport}"
+echo -e ""
echo -e "${lightgreen}Gamedig Raw Output${default}"
fn_messages_separator
echo -e ""