Browse Source

Pushed loggy options to config.json

hkremer/rebranding
Gregory Rudolph 4 years ago
parent
commit
2436872e8e
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 12
      config.json.sample
  2. 22
      main.go

12
config.json.sample

@ -9,9 +9,17 @@ @@ -9,9 +9,17 @@
"BumpTime": "",
"LastBumper": "",
"Stats": {
"374988675546873886": 80
},
"Unverified": {},
"Verifications": {},
"Probations": {}
"Probations": {
},
"LogOpts": {
"OutFile": "",
"KBTeam": "",
"KBChann": "",
"Level": 5,
"ProgName": "disgord-thanos",
"UseStdout": true
}
}

22
main.go

@ -18,20 +18,12 @@ import ( @@ -18,20 +18,12 @@ import (
)
var (
// Logging Setup
logOpts = loggy.LogOpts{
UseStdout: true,
Level: 5,
KBTeam: "nightmarehaus.logs.fetiche",
KBChann: "general",
ProgName: "disgord-thanos",
}
log = loggy.NewLogger(logOpts)
startupTime time.Time
setupToken = fmt.Sprintf("!setup %+v", rand.Intn(9999)+1000)
rebootToken = fmt.Sprintf("!reboot %+v", rand.Intn(9999)+1000)
bump = true
config Config
log = loggy.NewLogger(config.LogOpts)
lastActiveChan string
lastActiveTime time.Time
token string
@ -49,17 +41,19 @@ func init() { @@ -49,17 +41,19 @@ func init() {
func main() {
defer log.PanicSafe()
if configFile == "" {
configFile = "config.json"
} else {
loadConfig()
}
log = loggy.NewLogger(config.LogOpts)
startupTime = time.Now()
lastActiveTime = time.Now()
lastActiveChan = config.AdminChannel
if token == "" {
log.LogPanic("No token provided. Please run: disgord-thanos -t <bot token>")
}
if configFile == "" {
configFile = "config.json"
} else {
loadConfig()
}
log.LogCritical(fmt.Sprintf("SetupToken: %+v\nRebootToken: %+v", setupToken, rebootToken))
dg, err := discordgo.New("Bot " + token)
if err != nil {

Loading…
Cancel
Save