diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e5b46..06f41a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed some minor bugs regarding backup file sorting and migration procedures - Fixed bot cooldown being unreliable due to depending on multiple time sources +- Spaces at beginning of messages are now ignored for command checking (e.g. " !lurk" will match !lurk) ## [3.2.1] - 2023-05-17 diff --git a/twitch/bot.go b/twitch/bot.go index 9da8b42..915f376 100644 --- a/twitch/bot.go +++ b/twitch/bot.go @@ -147,10 +147,10 @@ func (b *Bot) onMessageHandler(message irc.PrivateMessage) { return } - lowercaseMessage := strings.ToLower(message.Message) + lowercaseMessage := strings.TrimSpace(strings.ToLower(message.Message)) // Check if it's a command - if strings.HasPrefix(message.Message, "!") { + if strings.HasPrefix(lowercaseMessage, "!") { // Run through supported commands for cmd, data := range b.commands.Copy() { if !data.Enabled {