added proper logging to most of the code
This commit is contained in:
parent
65c6020e49
commit
7d4c9c5ab9
21 changed files with 218 additions and 283 deletions
|
@ -2,6 +2,7 @@ package text
|
|||
|
||||
import (
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"github.com/rs/zerolog/log"
|
||||
"strings"
|
||||
"time"
|
||||
"watn3y/bloaterbotv3/commonlogic"
|
||||
|
@ -11,11 +12,14 @@ import (
|
|||
|
||||
func Matcher(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
||||
|
||||
log.Debug().Str("text", update.Message.Text).Int64("chat", update.Message.Chat.ID).Msg("Starting text matcher")
|
||||
|
||||
if time.Since(config.BotConfig.Shutup[update.Message.Chat.ID]) <= time.Minute*60 {
|
||||
log.Debug().Str("text", update.Message.Text).Int64("chat", update.Message.Chat.ID).Msg("Aborting due to shut-up")
|
||||
return
|
||||
}
|
||||
//balonlyl
|
||||
var isBalonlyl bool = false
|
||||
var isBalonlyl = false
|
||||
for _, word := range config.BotConfig.Balonlyl.TriggerWords {
|
||||
if strings.Contains(strings.ToLower(update.Message.Text), word) && (commonlogic.ContainsInt64(config.BotConfig.Balonlyl.EnabledChats, update.Message.Chat.ID)) {
|
||||
isBalonlyl = true
|
||||
|
@ -23,6 +27,7 @@ func Matcher(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
|||
}
|
||||
}
|
||||
if isBalonlyl {
|
||||
log.Debug().Str("text", update.Message.Text).Int64("chat", update.Message.Chat.ID).Msg("Matched Balonlyl meme")
|
||||
go balonlyl.Balonlyl(update, bot)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue