fix chat nil pointer issue

This commit is contained in:
c9s 2021-11-25 11:50:14 +08:00
parent 4bde40f2db
commit 8acc2cd87f

View File

@ -73,6 +73,10 @@ func (it *Interaction) HandleSubscribe(m *telebot.Message) {
return return
} }
if it.session.Chats == nil {
it.session.Chats = make(map[int64]bool)
}
it.session.Chats[m.Chat.ID] = true it.session.Chats[m.Chat.ID] = true
if _, err := it.bot.Send(m.Chat, "I just added your subscription"); err != nil { if _, err := it.bot.Send(m.Chat, "I just added your subscription"); err != nil {