1
0
Fork 0
mirror of https://git.sr.ht/~ashkeel/strimertul synced 2024-09-18 01:50:50 +00:00

fix: trim messages before checking for commands

fixes #86
This commit is contained in:
Ash Keel 2023-05-25 20:36:35 +02:00
parent e012fd2562
commit 4fbac65c1b
No known key found for this signature in database
GPG key ID: 53A9E9A6035DD109
2 changed files with 3 additions and 2 deletions

View file

@ -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

View file

@ -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 {