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

Fix twitch bot custom command checking

This commit is contained in:
Ash Keel 2021-12-01 23:32:51 +01:00
parent 49db94406d
commit 19064ac2ca
No known key found for this signature in database
GPG key ID: BAD8D93E7314ED3E
2 changed files with 15 additions and 3 deletions

View file

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [CURRENT]
### Fixed
- Twitch bot: fixed command checking, previous matching only checked for prefix (eg. !verylong could be called by writing !verylonglongbaaah)
## [1.6.3] - 2021-11-30
### Added
@ -55,6 +61,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Stulbe integration for alerts
[CURRENT]: https://github.com/strimertul/strimertul/compare/v1.6.3...HEAD
[1.6.3]: https://github.com/strimertul/strimertul/compare/v1.6.2...v1.6.3
[1.6.2]: https://github.com/strimertul/strimertul/compare/v1.6.1...v1.6.2
[1.6.1]: https://github.com/strimertul/strimertul/compare/v1.6.0...v1.6.1

View file

@ -90,10 +90,15 @@ func NewBot(api *Client, config BotConfig) *Bot {
continue
}
lc := strings.ToLower(cmd)
if strings.HasPrefix(lcmessage, lc) {
go cmdCustom(bot, cmd, data, message)
bot.lastMessage = time.Now()
if !strings.HasPrefix(lcmessage, lc) {
continue
}
parts := strings.SplitN(lcmessage, " ", 2)
if parts[0] != lc {
continue
}
go cmdCustom(bot, cmd, data, message)
bot.lastMessage = time.Now()
}
bot.mu.Unlock()