Skip to content

Commit

Permalink
Added command case insensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
cByst committed Nov 21, 2020
1 parent 6b6e1d6 commit 20491c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions amongushandlers/amongushandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down

0 comments on commit 20491c5

Please sign in to comment.