Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Beniamiiin committed Nov 29, 2023
1 parent 99d6836 commit ee869e2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions internal/tg_bot/handlers/access_governance_bot/command_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ func (h *accessGovernanceBotCommandHandler) Handle(update tgbotapi.Update) []tgb
telegramUser = callbackQuery.From
}

if (update.ChatMember.NewChatMember != tgbotapi.ChatMember{}) {
newChatMember := update.ChatMember.NewChatMember.User

user, err := h.userRepository.GetOneByTelegramNickname(newChatMember.UserName)
if err != nil {
h.logger.Errorw("failed to get user", "error", err)
return []tgbotapi.Chattable{}
}

user.TelegramID = newChatMember.ID

_, err = h.userRepository.Update(user)
if err != nil {
h.logger.Errorw("failed to update user", "error", err)
}

return []tgbotapi.Chattable{}
}

if telegramUser.ID != chatID {
h.logger.Infow("received message", "message", message)
return []tgbotapi.Chattable{}
Expand Down

0 comments on commit ee869e2

Please sign in to comment.