mirror of
https://github.com/mgerb/ServerStatus
synced 2026-01-09 18:52:50 +00:00
added role notification configuration
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"Token": "your_bot_token_id",
|
||||
"RoomIDList": ["id_1", "id_2", "id_3"],
|
||||
"RoleToNotify": "@Elysium",
|
||||
"Servers": [
|
||||
{
|
||||
"Name": "Elysium PvP",
|
||||
|
||||
BIN
dist/ServerStatus-linux
vendored
BIN
dist/ServerStatus-linux
vendored
Binary file not shown.
BIN
dist/ServerStatus-windows.exe
vendored
BIN
dist/ServerStatus-windows.exe
vendored
Binary file not shown.
1
dist/config.json
vendored
1
dist/config.json
vendored
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"Token": "your_bot_token_id",
|
||||
"RoomIDList": ["id_1", "id_2", "id_3"],
|
||||
"RoleToNotify": "@Elysium",
|
||||
"Servers": [
|
||||
{
|
||||
"Name": "Elysium PvP",
|
||||
|
||||
16
makefile
16
makefile
@@ -1,8 +1,16 @@
|
||||
run:
|
||||
@go run ./src/main.go
|
||||
|
||||
build:
|
||||
@rm -rf ./dist
|
||||
@GOOS=windows GOARCH=386 go build -o ./dist/ServerStatus-windows.exe ./src/main.go
|
||||
linux:
|
||||
@go build -o ./dist/ServerStatus-linux ./src/main.go
|
||||
@cp config.template.json ./dist/config.json
|
||||
|
||||
windows:
|
||||
@GOOS=windows GOARCH=386 go build -o ./dist/ServerStatus-windows.exe ./src/main.go
|
||||
|
||||
clean:
|
||||
@rm -rf ./dist
|
||||
|
||||
copyfiles:
|
||||
@cp config.template.json ./dist/config.json
|
||||
|
||||
all: linux windows copyfiles
|
||||
@@ -29,3 +29,9 @@ Anathema PvP is online!
|
||||
Darrowshire PvE is online!
|
||||
Elysium Authentication Server is online!
|
||||
```
|
||||
|
||||
## Compiling
|
||||
|
||||
Make sure you have Go installed.
|
||||
|
||||
`make clean all`
|
||||
|
||||
@@ -11,9 +11,10 @@ import (
|
||||
var Config configStruct
|
||||
|
||||
type configStruct struct {
|
||||
Token string `json:"Token"`
|
||||
RoomIDList []string `json:"RoomIDList"`
|
||||
Servers []server `json:"Servers"`
|
||||
Token string `json:"Token"`
|
||||
RoomIDList []string `json:"RoomIDList"`
|
||||
RoleToNotify string `json:"RoleToNotify"`
|
||||
Servers []server `json:"Servers"`
|
||||
}
|
||||
|
||||
type server struct {
|
||||
|
||||
@@ -36,9 +36,9 @@ func loop() {
|
||||
serverUp := elysiumPvP.IsOpen(server.Port) //check if the port is open
|
||||
|
||||
if serverUp && serverUp != prevServerUp {
|
||||
sendMessage("@here " + server.Name + " is now online!")
|
||||
sendMessage(config.Config.RoleToNotify + " " + server.Name + " is now online!")
|
||||
} else if !serverUp && serverUp != prevServerUp {
|
||||
sendMessage("@here " + server.Name + " went offline!")
|
||||
sendMessage(config.Config.RoleToNotify + " " + server.Name + " went offline!")
|
||||
}
|
||||
|
||||
config.Config.Servers[index].Online = serverUp
|
||||
|
||||
Reference in New Issue
Block a user