Fixing a bunch of bugs and making some improvements #19

Merged
skobkin merged 6 commits from fix_chat_type_middleware_nil_pointer into main 2024-03-12 20:08:50 +00:00
Showing only changes of commit a2a37d0256 - Show all commits

View file

@ -3,15 +3,22 @@ package bot
import (
"github.com/mymmrac/telego"
"github.com/mymmrac/telego/telegohandler"
"log/slog"
)
func (b *Bot) chatTypeStatsCounter(bot *telego.Bot, update telego.Update, next telegohandler.Handler) {
message := update.Message
if message == nil {
slog.Info("chat-type-middleware: update has no message. skipping.")
next(bot, update)
return
}
slog.Info("chat-type-middleware: counting message chat type in stats", "type", message.Chat.Type)
switch message.Chat.Type {
case telego.ChatTypeGroup, telego.ChatTypeSupergroup:
b.stats.GroupRequest()