From 20491c55b509b7e58055173dd0186113085290e0 Mon Sep 17 00:00:00 2001 From: cByst Date: Sat, 21 Nov 2020 11:51:51 -0500 Subject: [PATCH] Added command case insensitivity --- amongushandlers/amongushandlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amongushandlers/amongushandlers.go b/amongushandlers/amongushandlers.go index 71dabfb..219b1ab 100644 --- a/amongushandlers/amongushandlers.go +++ b/amongushandlers/amongushandlers.go @@ -109,7 +109,7 @@ func commandHandler(s *discordgo.Session, m *discordgo.MessageCreate) { } // Check message for for command prefix to determine if the message is relevant to the bot - if strings.HasPrefix(m.Content, "!CreateAmongEvent ") { + if strings.HasPrefix(strings.ToLower(m.Content), "!createamongevent ") { // Check if user is privileged to command the bot userIsPrivledged, err := isUserPrivleged(s, m.Author.ID, m.GuildID) if err != nil { @@ -122,7 +122,7 @@ func commandHandler(s *discordgo.Session, m *discordgo.MessageCreate) { // tell users there not permissioned for this return } else { - title := strings.Trim(strings.TrimPrefix(m.Content, "!CreateAmongEvent "), "\"") + title := strings.Trim(m.Content[18:len(m.Content)], "\"") log.Infof("Creating new among event with title: %s for user: %s", title, m.Author.Username) err = amongusevents.CreateEvent(s, title, m.ChannelID)