telegram-ollama-reply-bot/bot/middleware.go
Alexey Skobkin fe5db2b06f
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Fixing private requests counter.
2024-03-11 23:24:46 +03:00

24 lines
464 B
Go

package bot
import (
"github.com/mymmrac/telego"
"github.com/mymmrac/telego/telegohandler"
)
func (b *Bot) chatTypeStatsCounter(bot *telego.Bot, update telego.Update, next telegohandler.Handler) {
message := update.Message
if message == nil {
next(bot, update)
}
switch message.Chat.Type {
case telego.ChatTypeGroup, telego.ChatTypeSupergroup:
b.stats.GroupRequest()
case telego.ChatTypePrivate:
b.stats.PrivateRequest()
}
next(bot, update)
}