1
0
mirror of https://github.com/mgerb/ServerStatus synced 2026-01-12 04:02:48 +00:00

1 Commits

Author SHA1 Message Date
242f840180 added embedded messages 2018-03-15 21:03:47 -05:00
4 changed files with 6 additions and 21 deletions

View File

@@ -3,7 +3,6 @@
"RoomIDList":["room id list goes here"], "RoomIDList":["room id list goes here"],
"RolesToNotify": ["<@&roleid>", "<@userid>"], "RolesToNotify": ["<@&roleid>", "<@userid>"],
"GameStatus": "current playing game", "GameStatus": "current playing game",
"PollingInterval": 10,
"Servers": [ "Servers": [
{ {
"Name": "Your awesome server", "Name": "Your awesome server",

View File

@@ -6,19 +6,17 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
"os" "os"
"time"
) )
// Variables used for command line parameters // Variables used for command line parameters
var Config configStruct var Config configStruct
type configStruct struct { type configStruct struct {
Token string `json:"Token"` Token string `json:"Token"`
RoomIDList []string `json:"RoomIDList"` RoomIDList []string `json:"RoomIDList"`
RolesToNotify []string `json:"RolesToNotify"` RolesToNotify []string `json:"RolesToNotify"`
Servers []server `json:"Servers"` Servers []server `json:"Servers"`
GameStatus string `json:"GameStatus"` GameStatus string `json:"GameStatus"`
PollingInterval time.Duration `json:"PollingInterval"`
} }
type server struct { type server struct {
@@ -45,8 +43,4 @@ func Configure() {
log.Println(err) log.Println(err)
} }
if Config.PollingInterval == 0 {
log.Fatal("Please set your PollingInterval > 0 in your config file.")
}
} }

View File

@@ -17,14 +17,6 @@ NOTE: This bot currently does not work for UDP servers.
- for user `<@userid>` - for user `<@userid>`
- for role `<@&roleid>` - for role `<@&roleid>`
### Polling Interval
The polling interval is how often the bot will try to ping the servers.
A good interval is 10 seconds, but this may need some adjustment if
it happens to be spamming notifications.
- time in seconds
- configurable in `config.json`
## Usage ## Usage
To get the current status of your servers simply type `!ServerStatus` in chat. To get the current status of your servers simply type `!ServerStatus` in chat.

View File

@@ -61,7 +61,7 @@ func scanServers() {
config.Config.Servers[index].Online = serverUp config.Config.Servers[index].Online = serverUp
} }
time.Sleep(time.Second * config.Config.PollingInterval) time.Sleep(time.Second * 5)
} }
} }