Preparations for tgbot additions

This commit is contained in:
somebodywashere 2023-12-19 22:08:46 +03:00
parent 57dfb8ae36
commit b4f85508d3
2 changed files with 27 additions and 0 deletions

View file

@ -1184,6 +1184,32 @@ func (s *InboundService) SetClientTelegramUserID(trafficId int, tgId string) err
return nil
}
func (s *InboundService) checkIsEnabledByEmail(clientEmail string) (bool, error) {
_, inbound, err := s.GetClientInboundByEmail(clientEmail)
if err != nil {
return false, err
}
if inbound == nil {
return false, common.NewError("Inbound Not Found For Email:", clientEmail)
}
clients, err := s.GetClients(inbound)
if err != nil {
return false, err
}
isEnable := false
for _, client := range clients {
if client.Email == clientEmail {
isEnable = client.Enable
break
}
}
return isEnable, err
}
func (s *InboundService) ToggleClientEnableByEmail(clientEmail string) (bool, error) {
_, inbound, err := s.GetClientInboundByEmail(clientEmail)
if err != nil {

View file

@ -672,6 +672,7 @@ func (t *Tgbot) asnwerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool
t.searchClient(chatId, email, callbackQuery.Message.MessageID)
} else {
t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.errorOperation"))
logger.Error(err)
}
}
return