1
0
mirror of https://github.com/mgerb/ServerStatus synced 2026-01-10 03:03:04 +00:00

added role notification configuration

This commit is contained in:
2017-01-17 21:29:53 +01:00
parent 72f06fe031
commit c03184e422
8 changed files with 26 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
{
"Token": "your_bot_token_id",
"RoomIDList": ["id_1", "id_2", "id_3"],
"RoleToNotify": "@Elysium",
"Servers": [
{
"Name": "Elysium PvP",

Binary file not shown.

Binary file not shown.

1
dist/config.json vendored
View File

@@ -1,6 +1,7 @@
{
"Token": "your_bot_token_id",
"RoomIDList": ["id_1", "id_2", "id_3"],
"RoleToNotify": "@Elysium",
"Servers": [
{
"Name": "Elysium PvP",

View File

@@ -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
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

View File

@@ -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`

View File

@@ -13,6 +13,7 @@ var Config configStruct
type configStruct struct {
Token string `json:"Token"`
RoomIDList []string `json:"RoomIDList"`
RoleToNotify string `json:"RoleToNotify"`
Servers []server `json:"Servers"`
}

View File

@@ -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