mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-09-05 01:36:19 +00:00
Preparations for tgbot additions
This commit is contained in:
parent
57dfb8ae36
commit
b4f85508d3
2 changed files with 27 additions and 0 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue