fix: fixed the panic when getting nil chat.

This commit is contained in:
Andrey Parhomenko 2024-01-28 16:54:50 +03:00
parent 638b1c1f78
commit 6940150f31

9
bot.go
View file

@ -200,7 +200,14 @@ func (bot *Bot) Run() error {
u := &Update{
Update: &up,
}
chn, ok := handles[u.FromChat().Type]
// Sometimes returns nil.
fromChat := u.FromChat()
if fromChat == nil {
continue
}
chn, ok := handles[fromChat.Type]
if !ok {
continue
}