|
|
|
@ -8,6 +8,8 @@ import (
@@ -8,6 +8,8 @@ import (
|
|
|
|
|
"strconv" |
|
|
|
|
"strings" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/rudi9719/loggy" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func setupCommands() { |
|
|
|
@ -69,6 +71,15 @@ func setupCommands() {
@@ -69,6 +71,15 @@ func setupCommands() {
|
|
|
|
|
Exec: Commands, |
|
|
|
|
} |
|
|
|
|
commands = append(commands, listCommands) |
|
|
|
|
|
|
|
|
|
debugLevel := Command{ |
|
|
|
|
Name: "Debug Level", |
|
|
|
|
RequiresAdmin: true, |
|
|
|
|
Keywords: []string{"debug"}, |
|
|
|
|
Exec: Debug, |
|
|
|
|
Help: "Set the log level for loggy", |
|
|
|
|
} |
|
|
|
|
commands = append(commands, debugLevel) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Commands(b BotCommand) bool { |
|
|
|
@ -87,6 +98,17 @@ func Commands(b BotCommand) bool {
@@ -87,6 +98,17 @@ func Commands(b BotCommand) bool {
|
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Debug(b BotCommand) bool { |
|
|
|
|
defer log.PanicSafe() |
|
|
|
|
level, err := strconv.Atoi(b.Parts[0]) |
|
|
|
|
if err != nil { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
config.LogOpts.Level = loggy.LogLevel(level) |
|
|
|
|
log = loggy.NewLogger(config.LogOpts) |
|
|
|
|
return true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Reboot(b BotCommand) bool { |
|
|
|
|
defer log.PanicSafe() |
|
|
|
|
if strings.Contains(b.Message.Content, rebootToken) { |
|
|
|
|