diff --git a/config.template.json b/config.template.json index 9bb267e..ce27e39 100644 --- a/config.template.json +++ b/config.template.json @@ -1,6 +1,7 @@ { "Token": "your_bot_token_id", "RoomIDList": ["id_1", "id_2", "id_3"], + "RoleToNotify": "@Elysium", "Servers": [ { "Name": "Elysium PvP", diff --git a/dist/ServerStatus-linux b/dist/ServerStatus-linux index 89d26a3..40389d7 100755 Binary files a/dist/ServerStatus-linux and b/dist/ServerStatus-linux differ diff --git a/dist/ServerStatus-windows.exe b/dist/ServerStatus-windows.exe index d927aa7..3ec57ba 100755 Binary files a/dist/ServerStatus-windows.exe and b/dist/ServerStatus-windows.exe differ diff --git a/dist/config.json b/dist/config.json index 9bb267e..ce27e39 100644 --- a/dist/config.json +++ b/dist/config.json @@ -1,6 +1,7 @@ { "Token": "your_bot_token_id", "RoomIDList": ["id_1", "id_2", "id_3"], + "RoleToNotify": "@Elysium", "Servers": [ { "Name": "Elysium PvP", diff --git a/makefile b/makefile index 7d6e36b..7c6e105 100644 --- a/makefile +++ b/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 \ No newline at end of file + +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 \ No newline at end of file diff --git a/readme.md b/readme.md index 15504a9..034977e 100644 --- a/readme.md +++ b/readme.md @@ -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` diff --git a/src/config/config.go b/src/config/config.go index f70df70..6ece504 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -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 { diff --git a/src/serverstatus/serverstatus.go b/src/serverstatus/serverstatus.go index bf1264d..b36ec3b 100644 --- a/src/serverstatus/serverstatus.go +++ b/src/serverstatus/serverstatus.go @@ -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