mirror of
https://github.com/mgerb/ServerStatus
synced 2026-01-12 12:12:48 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 217c6c8baa | |||
| 5a2f81a23a | |||
| f8e552caa6 |
@@ -1,33 +1,17 @@
|
|||||||
{
|
{
|
||||||
"Token": "your_bot_token_id",
|
"Token": "your bot token",
|
||||||
"RoomIDList": ["id_1", "id_2", "id_3"],
|
"RoomIDList":["room id list goes here"],
|
||||||
"RoleToNotify": "@Elysium",
|
"RoleToNotify": "@everyone",
|
||||||
"GameStatus": "current playing game",
|
"GameStatus": "current playing game",
|
||||||
"Servers": [
|
"Servers": [
|
||||||
{
|
{
|
||||||
"Name": "Elysium PvP",
|
"Name": "Your awesome server",
|
||||||
"Address": "149.202.207.235",
|
"Address": "game.server.com",
|
||||||
"Port": 8099
|
"Port": 80
|
||||||
},
|
}, {
|
||||||
{
|
"Name": "Another awesome server",
|
||||||
"Name": "Zethkur PvP",
|
"Address": "awesome.server.com",
|
||||||
"Address": "151.80.103.221",
|
"Port": 8080
|
||||||
"Port": 8093
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Anathema PvP",
|
|
||||||
"Address": "149.202.211.5",
|
|
||||||
"Port": 8095
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Darrowshire PvE",
|
|
||||||
"Address": "164.132.233.125",
|
|
||||||
"Port": 8097
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"Name": "Elysium Authentication Server",
|
|
||||||
"Address": "logon.elysium-project.org",
|
|
||||||
"Port": 3724
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"./bot"
|
"github.com/mgerb/serverstatus/bot"
|
||||||
"./config"
|
"github.com/mgerb/serverstatus/config"
|
||||||
"./serverstatus"
|
"github.com/mgerb/serverstatus/serverstatus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Variables used for command line parameters
|
// Variables used for command line parameters
|
||||||
8
makefile
8
makefile
@@ -2,13 +2,13 @@ run:
|
|||||||
go run ./src/main.go
|
go run ./src/main.go
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
go build -o ./dist/ServerStatus-linux ./src/main.go
|
go build -o ./dist/ServerStatus-linux ./main.go
|
||||||
|
|
||||||
mac:
|
mac:
|
||||||
GOOS=darwin GOARCH=amd64 go build -o ./dist/ServerStatus-mac ./src/main.go
|
GOOS=darwin GOARCH=amd64 go build -o ./dist/ServerStatus-mac ./main.go
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
GOOS=windows GOARCH=386 go build -o ./dist/ServerStatus-windows.exe ./src/main.go
|
GOOS=windows GOARCH=386 go build -o ./dist/ServerStatus-windows.exe ./main.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf ./dist
|
rm -rf ./dist
|
||||||
@@ -16,4 +16,4 @@ clean:
|
|||||||
copyfiles:
|
copyfiles:
|
||||||
cp config.template.json ./dist/config.json
|
cp config.template.json ./dist/config.json
|
||||||
|
|
||||||
all: linux mac windows copyfiles
|
all: linux mac windows copyfiles
|
||||||
|
|||||||
11
readme.md
11
readme.md
@@ -1,10 +1,15 @@
|
|||||||
## Server Status
|
## Server Status
|
||||||
|
|
||||||
Scans a list of servers checking whether the ports are open or not.
|
Scans a list of servers checking whether the ports are open or not.
|
||||||
This bot will send a chat notification when the status of a server changes.
|
This bot will send a chat notification when the status of a server changes (goes on or offline).
|
||||||
|
|
||||||
I originally made this bot the check if private World of Warcraft servers were up or not.
|
I originally made this bot to check if private World of Warcraft servers were up or not.
|
||||||
This bot is actually much more useful than that and can be used for any type of server.
|
It's actually much more useful than that and can be used for most servers.
|
||||||
|
|
||||||
|
It has been brought to my attention that this bot currently does not work for Ark servers.
|
||||||
|
|
||||||
|
### Note - updated for Felmyst server!
|
||||||
|
The config template contains IP/Ports for the new Felmyst game and logon servers
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
package serverstatus
|
package serverstatus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"../bot"
|
|
||||||
"../config"
|
|
||||||
"fmt"
|
|
||||||
"github.com/anvie/port-scanner"
|
|
||||||
"github.com/bwmarrin/discordgo"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/anvie/port-scanner"
|
||||||
|
"github.com/bwmarrin/discordgo"
|
||||||
|
"github.com/mgerb/serverstatus/bot"
|
||||||
|
"github.com/mgerb/serverstatus/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Start() {
|
func Start() {
|
||||||
@@ -30,7 +30,7 @@ func scanServers() {
|
|||||||
|
|
||||||
//check if server are in config file
|
//check if server are in config file
|
||||||
if len(config.Config.Servers) < 1 {
|
if len(config.Config.Servers) < 1 {
|
||||||
fmt.Println("No servers in config file.")
|
log.Println("No servers in config file.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ func scanServers() {
|
|||||||
for index, server := range config.Config.Servers {
|
for index, server := range config.Config.Servers {
|
||||||
prevServerUp := server.Online //set value to previous server status
|
prevServerUp := server.Online //set value to previous server status
|
||||||
|
|
||||||
serverScanner := portscanner.NewPortScanner(server.Address, time.Second*2)
|
serverScanner := portscanner.NewPortScanner(server.Address, time.Second*2, 1)
|
||||||
serverUp := serverScanner.IsOpen(server.Port) //check if the port is open
|
serverUp := serverScanner.IsOpen(server.Port) //check if the port is open
|
||||||
|
|
||||||
if serverUp && serverUp != prevServerUp {
|
if serverUp && serverUp != prevServerUp {
|
||||||
Reference in New Issue
Block a user