Skip to content

Instantly share code, notes, and snippets.

@gamersalpha
Created November 6, 2017 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamersalpha/11179b34cddde5434e3713f73603b699 to your computer and use it in GitHub Desktop.
Save gamersalpha/11179b34cddde5434e3713f73603b699 to your computer and use it in GitHub Desktop.
#!/bin/bash
# LinuxGSM alert_discord.sh function
# Author: Daniel Gibbs
# Contributor: faflfama
# Website: https://gameservermanagers.com
# Description: Sends Discord alert.
json=$(cat <<EOF
{
"username":"LinuxGSM",
"avatar_url":"https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png",
"file":"content",
"embeds": [{
"color": "2067276",
"author": {"name": "Hello World", "icon_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png"},
"title": "",
"description": "",
"url": "",
"type": "content",
"thumbnail": {"url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png"},
"footer": {"text": "LinuxGSM", "icon_url": "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/images/logo/lgsm-dark-square-512.png"},
"fields": [
{
"name": "Alert Message",
"value": "This is Alert Message"
},
{
"name": "Game",
"value": "this is u game !!"
},
{
"name": "Server name",
"value": "This is u server"
},
{
"name": "Hostname",
"value": "This is My Hostname"
},
{
"name": "Server IP",
"value": "And this is my IP"
},
{
"name": "More info",
"value": "i can give u more information ?"
}
]
}]
}
EOF
)
discordwebhook="https://discordapp.com/api/webhooks/XXXXXXX"
discordsend=$(curl -sSL -H "Content-Type: application/json" -X POST -d """${json}""" ${discordwebhook})
echo ${json}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment