add nil check for group update

This commit is contained in:
Yousef Mansy
2023-04-01 16:33:37 -07:00
parent 5bbe422161
commit aae654bfa4

View File

@@ -264,14 +264,14 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
} }
func (b *Btelegram) handleGroupUpdate(update tgbotapi.Update) { func (b *Btelegram) handleGroupUpdate(update tgbotapi.Update) {
msg := update.Message if msg := update.Message; msg != nil {
switch { switch {
case msg.NewChatMembers != nil: case msg.NewChatMembers != nil:
b.handleUserJoin(update) b.handleUserJoin(update)
case msg.LeftChatMember != nil: case msg.LeftChatMember != nil:
b.handleUserLeave(update) b.handleUserLeave(update)
} }
}
} }
func (b *Btelegram) handleUserJoin(update tgbotapi.Update) { func (b *Btelegram) handleUserJoin(update tgbotapi.Update) {