diff --git a/commands.go b/commands.go index 2e2ad4f..25ba3d3 100644 --- a/commands.go +++ b/commands.go @@ -102,7 +102,7 @@ func Commands(b BotCommand) bool { func Debug(b BotCommand) bool { defer log.PanicSafe() - level, err := strconv.Atoi(b.Parts[2]) + level, err := strconv.Atoi(b.Parts[0]) if err != nil { return false } @@ -123,10 +123,9 @@ func Reboot(b BotCommand) bool { func BumpSet(b BotCommand) bool { defer log.PanicSafe() bump = false - parts := strings.Split(b.Message.Content, " ") - timer, err := strconv.Atoi(parts[2]) + timer, err := strconv.Atoi(b.Parts[0]) if err != nil { - b.Session.ChannelMessageSend(b.Message.ChannelID, fmt.Sprintf("Unable to decode timer: %+v", parts[2])) + b.Session.ChannelMessageSend(b.Message.ChannelID, fmt.Sprintf("Unable to decode timer: %+v", b.Parts[0])) return false } config.BumpTime = time.Now().Add(time.Duration(timer) * time.Minute).Add(-2 * time.Hour) @@ -138,8 +137,7 @@ func RetrieveVerification(b BotCommand) bool { defer log.PanicSafe() s := b.Session m := b.Message - parts := strings.Split(m.Content, " ") - discordId := parts[1] + discordId := b.Parts[0] _, err := strconv.Atoi(discordId) if err != nil { discordId = idFromUsername(discordId) diff --git a/discordMessage.go b/discordMessage.go index dfd3204..020aa39 100644 --- a/discordMessage.go +++ b/discordMessage.go @@ -43,7 +43,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { b := BotCommand{ Session: s, Message: m, - Parts: strings.Split(m.Content, " ")[1:], + Parts: strings.Split(m.Content, " ")[2:], } log.LogDebug("%+v", b.Parts) for _, cmd := range commands {