diff --git a/go.mod b/go.mod index fe0f83f6..02515227 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ require ( github.com/gin-contrib/sessions v1.0.2 github.com/gin-gonic/gin v1.10.0 github.com/goccy/go-json v0.10.5 + github.com/google/uuid v1.6.0 github.com/mymmrac/telego v0.32.0 github.com/nicksnyder/go-i18n/v2 v2.5.1 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 9e217124..21baba38 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -1,9 +1,12 @@ package service import ( + "crypto/rand" "embed" + "encoding/base64" "errors" "fmt" + "math/big" "net" "net/url" "os" @@ -20,8 +23,7 @@ import ( "x-ui/web/locale" "x-ui/xray" - "slices" - + "github.com/google/uuid" "github.com/mymmrac/telego" th "github.com/mymmrac/telego/telegohandler" tu "github.com/mymmrac/telego/telegoutil" @@ -30,14 +32,38 @@ import ( ) var ( - bot *telego.Bot - botHandler *th.BotHandler - adminIds []int64 - isRunning bool - hostname string - hashStorage *global.HashStorage + bot *telego.Bot + botHandler *th.BotHandler + adminIds []int64 + isRunning bool + hostname string + hashStorage *global.HashStorage + handler *th.Handler + + // clients data to adding new client + receiver_inbound_ID int + client_Id string + client_Flow string + client_Email string + client_LimitIP int + client_TotalGB int64 + client_ExpiryTime int64 + client_Enable bool + client_TgID string + client_SubID string + client_Comment string + client_Reset int + client_Security string + client_ShPassword string + client_TrPassword string + client_Method string + ) + +var userStates = make(map[int64]string) + + type LoginStatus byte const ( @@ -46,6 +72,8 @@ const ( EmptyTelegramUserID = int64(0) ) +const charset = "abcdefghijklmnopqrstuvwxyz0123456789" + type Tgbot struct { inboundService InboundService settingService SettingService @@ -54,6 +82,7 @@ type Tgbot struct { lastStatus *Status } + func (t *Tgbot) NewTgbot() *Tgbot { return new(Tgbot) } @@ -223,36 +252,102 @@ func (t *Tgbot) OnReceive() { botHandler, _ = th.NewBotHandler(bot, updates) botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { + delete(userStates, message.Chat.ID) t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.keyboardClosed"), tu.ReplyKeyboardRemove()) }, th.TextEqual(t.I18nBot("tgbot.buttons.closeKeyboard"))) botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { + delete(userStates, message.Chat.ID) t.answerCommand(&message, message.Chat.ID, checkAdmin(message.From.ID)) }, th.AnyCommand()) botHandler.HandleCallbackQuery(func(_ *telego.Bot, query telego.CallbackQuery) { + delete(userStates,query.Message.GetChat().ID) t.answerCallback(&query, checkAdmin(query.From.ID)) }, th.AnyCallbackQueryWithMessage()) botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { - if message.UsersShared != nil { - if checkAdmin(message.From.ID) { - for _, sharedUser := range message.UsersShared.Users { - userID := sharedUser.UserID - needRestart, err := t.inboundService.SetClientTelegramUserID(message.UsersShared.RequestID, userID) - if needRestart { - t.xrayService.SetToNeedRestart() + if userState, exists := userStates[message.Chat.ID]; exists { + switch userState { + case "awaiting_id": + client_Id = message.Text + userStates[message.Chat.ID] = "awaiting_email" + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.received_id", "ClientId=="+client_Id), tu.ReplyKeyboardRemove()) + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_email"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.email_prompt", "ClientEmail=="+client_Email), cancel_btn_markup) + case "awaiting_password_tr": + client_TrPassword = message.Text + userStates[message.Chat.ID] = "awaiting_email" + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.received_password", "ClientPass=="+client_TrPassword), tu.ReplyKeyboardRemove()) + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_email"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.email_prompt", "ClientEmail=="+client_Email), cancel_btn_markup) + case "awaiting_password_sh": + client_ShPassword = message.Text + userStates[message.Chat.ID] = "awaiting_email" + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.received_password", "ClientPass=="+client_ShPassword), tu.ReplyKeyboardRemove()) + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_email"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.email_prompt", "ClientEmail=="+client_Email), cancel_btn_markup) + case "awaiting_email": + client_Email = message.Text + userStates[message.Chat.ID] = "awaiting_comment" + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.received_email", "ClientEmail=="+client_Email), tu.ReplyKeyboardRemove()) + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_comment"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.comment_prompt", "ClientComment=="+client_Comment), cancel_btn_markup) + case "awaiting_comment": + client_Comment = message.Text + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.messages.received_comment", "ClientComment=="+client_Comment), tu.ReplyKeyboardRemove()) + message_text, _ := t.BuildClientDataMessage() + + inlineKeyboard := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + ), + ) + t.SendMsgToTgbot(message.Chat.ID, message_text, inlineKeyboard) + delete(userStates, message.Chat.ID) + } + + } else { + if message.UsersShared != nil { + if checkAdmin(message.From.ID) { + for _, sharedUser := range message.UsersShared.Users { + userID := sharedUser.UserID + needRestart, err := t.inboundService.SetClientTelegramUserID(message.UsersShared.RequestID, userID) + if needRestart { + t.xrayService.SetToNeedRestart() + } + output := "" + if err != nil { + output += t.I18nBot("tgbot.messages.selectUserFailed") + } else { + output += t.I18nBot("tgbot.messages.userSaved") + } + t.SendMsgToTgbot(message.Chat.ID, output, tu.ReplyKeyboardRemove()) } - output := "" - if err != nil { - output += t.I18nBot("tgbot.messages.selectUserFailed") - } else { - output += t.I18nBot("tgbot.messages.userSaved") - } - t.SendMsgToTgbot(message.Chat.ID, output, tu.ReplyKeyboardRemove()) + } else { + t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.noResult"), tu.ReplyKeyboardRemove()) } - } else { - t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.noResult"), tu.ReplyKeyboardRemove()) } } }, th.AnyMessage()) @@ -344,6 +439,27 @@ func (t *Tgbot) sendResponse(chatId int64, msg string, onlyMessage, isAdmin bool } } + +func (t *Tgbot) randomLowerAndNum(length int) string { + bytes := make([]byte, length) + for i := range bytes { + randomIndex, _ := rand.Int(rand.Reader, big.NewInt(int64(len(charset)))) + bytes[i] = charset[randomIndex.Int64()] + } + return string(bytes) +} + + +func (t *Tgbot) randomShadowSocksPassword() string { + array := make([]byte, 32) + _, err := rand.Read(array) + if err != nil { + return t.randomLowerAndNum(32) + } + return base64.StdEncoding.EncodeToString(array) +} + + func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool) { chatId := callbackQuery.Message.GetChat().ID @@ -838,7 +954,40 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool return } t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.chooseClient", "Inbound=="+inbound.Remark), clients) + case "add_client_to": + // assign default values to clients variables + client_Id = uuid.New().String() + client_Flow = "" + client_Email = t.randomLowerAndNum(8) + client_LimitIP = 0 + client_TotalGB = 0 + client_ExpiryTime = 0 + client_Enable = true + client_TgID = "" + client_SubID = t.randomLowerAndNum(16) + client_Comment = "" + client_Reset = 0 + client_Security="auto" + client_ShPassword=t.randomShadowSocksPassword() + client_TrPassword=t.randomLowerAndNum(10) + client_Method="" + inboundId := dataArray[1] + inboundIdInt, err := strconv.Atoi(inboundId) + if err != nil { + t.sendCallbackAnswerTgBot(callbackQuery.ID, err.Error()) + return + } + receiver_inbound_ID = inboundIdInt + inbound, err := t.inboundService.GetInbound(inboundIdInt) + if err != nil { + t.sendCallbackAnswerTgBot(callbackQuery.ID, err.Error()) + return + } + + message_text, err := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) + + t.addClient(chatId, message_text) } return } else { @@ -892,11 +1041,275 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool case "commands": t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.buttons.commands")) t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.commands.helpAdminCommands")) + case "add_client": + // assign default values to clients variables + client_Id = uuid.New().String() + client_Flow = "" + client_Email = t.randomLowerAndNum(8) + client_LimitIP = 0 + client_TotalGB = 0 + client_ExpiryTime = 0 + client_Enable = true + client_TgID = "" + client_SubID = t.randomLowerAndNum(16) + client_Comment = "" + client_Reset = 0 + client_Security="auto" + client_ShPassword=t.randomShadowSocksPassword() + client_TrPassword=t.randomLowerAndNum(10) + client_Method="" + + inbounds, err := t.getInboundsAddClient() + if err != nil { + t.sendCallbackAnswerTgBot(callbackQuery.ID, err.Error()) + return + } + t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.buttons.addClient")) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.chooseInbound"), inbounds) + case "add_client_ch_default": + var prompt_state string + var prompt_message string + + + prompt_state ,prompt_message, _ = t.BuildClientChDefaultResponse() + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_id_pass"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(chatId, prompt_message,cancel_btn_markup) + userStates[chatId] = prompt_state + case "default_client_id_pass": + cancel_btn_markup := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_email"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.email_prompt", "ClientEmail=="+client_Email),cancel_btn_markup) + userStates[chatId] = "awaiting_email" + case "default_client_email": + inlineKeyboard := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.use_default")).WithCallbackData("default_client_comment"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.comment_prompt", "ClientComment=="+client_Comment),inlineKeyboard) + userStates[chatId] = "awaiting_comment" + case "default_client_comment": + message_text, _ := t.BuildClientDataMessage() + + inlineKeyboard := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + + t.SendMsgToTgbot(chatId, message_text, inlineKeyboard) + delete(userStates, chatId) + case "add_client_cancel": + delete(userStates, chatId) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.cancel"), tu.ReplyKeyboardRemove()) + case "add_client_submit_disable": + client_Enable = false + _, err := t.SubmitAddClient() + if err != nil { + errorMessage := fmt.Sprintf("%v", err) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.error_add_client", "error=="+errorMessage), tu.ReplyKeyboardRemove()) + } else { + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.messages.success_add_client"), tu.ReplyKeyboardRemove()) + } } } + +func (t *Tgbot) BuildClientChDefaultResponse() (string,string,error) { + + inbound, err := t.inboundService.GetInbound(receiver_inbound_ID) + if err != nil { + logger.Warning("getIboundClients run failed:", err) + return "", "",errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + + protocol := inbound.Protocol + + switch protocol { + case model.VMESS, model.VLESS: + prompt := t.I18nBot("tgbot.messages.id_prompt", "ClientId=="+client_Id) + return "awaiting_id", prompt,errors.New("unknown protocol") + case model.Trojan: + prompt := t.I18nBot("tgbot.messages.pass_prompt", "ClientPassword=="+client_TrPassword) + return "awaiting_password_tr", prompt,errors.New("unknown protocol") + case model.Shadowsocks: + prompt := t.I18nBot("tgbot.messages.pass_prompt", "ClientPassword=="+client_ShPassword) + return "awaiting_password_sh", prompt,errors.New("unknown protocol") + default: + return "","", errors.New("unknown protocol") + } +} + + +func (t *Tgbot) BuildInboundClientDataMessage(inbound_remark string ,protocol model.Protocol) (string, error) { + var message string + + switch protocol { + case model.VMESS, model.VLESS: + message = t.I18nBot("tgbot.messages.inbound_client_data_id", "InboundRemark=="+inbound_remark,"ClientId=="+client_Id,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + case model.Trojan: + message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark,"ClientPass=="+client_TrPassword,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + case model.Shadowsocks: + message = t.I18nBot("tgbot.messages.inbound_client_data_pass", "InboundRemark=="+inbound_remark,"ClientPass=="+client_ShPassword,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + default: + return "", errors.New("unknown protocol") + } + + return message, nil +} + +func (t *Tgbot) BuildClientDataMessage() (string, error) { + var message string + + inbound, err := t.inboundService.GetInbound(receiver_inbound_ID) + if err != nil { + logger.Warning("getIboundClients run failed:", err) + return "", errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + protocol := inbound.Protocol + + + switch protocol { + case model.VMESS, model.VLESS: + message = t.I18nBot("tgbot.messages.client_data_id", "ClientId=="+client_Id,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + case model.Trojan: + message = t.I18nBot("tgbot.messages.client_data_pass", "ClientPass=="+client_TrPassword,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + case model.Shadowsocks: + message = t.I18nBot("tgbot.messages.client_data_pass", "ClientPass=="+client_ShPassword,"ClientEmail=="+client_Email,"ClientComment=="+client_Comment) + + default: + return "", errors.New("unknown protocol") + } + + return message, nil +} + + + +func (t *Tgbot) BuildJSONForProtocol(protocol model.Protocol) (string, error) { + var jsonString string + + switch protocol { + case model.VMESS: + jsonString = fmt.Sprintf(`{ + "clients": [{ + "id": "%s", + "security": "%s", + "email": "%s", + "limitIp": %d, + "totalGB": %d, + "expiryTime": %d, + "enable": %t, + "tgId": "%s", + "subId": "%s", + "comment": "%s", + "reset": %d + }] + }`, client_Id, client_Security, client_Email, client_LimitIP, client_TotalGB, client_ExpiryTime, client_Enable, client_TgID, client_SubID, client_Comment, client_Reset) + + case model.VLESS: + jsonString = fmt.Sprintf(`{ + "clients": [{ + "id": "%s", + "flow": "%s", + "email": "%s", + "limitIp": %d, + "totalGB": %d, + "expiryTime": %d, + "enable": %t, + "tgId": "%s", + "subId": "%s", + "comment": "%s", + "reset": %d + }] + }`, client_Id, client_Flow, client_Email, client_LimitIP, client_TotalGB, client_ExpiryTime, client_Enable, client_TgID, client_SubID, client_Comment, client_Reset) + + case model.Trojan: + jsonString = fmt.Sprintf(`{ + "clients": [{ + "password": "%s", + "email": "%s", + "limitIp": %d, + "totalGB": %d, + "expiryTime": %d, + "enable": %t, + "tgId": "%s", + "subId": "%s", + "comment": "%s", + "reset": %d + }] + }`, client_TrPassword, client_Email, client_LimitIP, client_TotalGB, client_ExpiryTime, client_Enable, client_TgID, client_SubID, client_Comment, client_Reset) + + case model.Shadowsocks: + jsonString = fmt.Sprintf(`{ + "clients": [{ + "method": "%s", + "password": "%s", + "email": "%s", + "limitIp": %d, + "totalGB": %d, + "expiryTime": %d, + "enable": %t, + "tgId": "%s", + "subId": "%s", + "comment": "%s", + "reset": %d + }] + }`, client_Method, client_ShPassword, client_Email, client_LimitIP, client_TotalGB, client_ExpiryTime, client_Enable, client_TgID, client_SubID, client_Comment, client_Reset) + + default: + return "", errors.New("unknown protocol") + } + + return jsonString, nil +} + + +func (t *Tgbot) SubmitAddClient() (bool, error) { + + + inbound, err := t.inboundService.GetInbound(receiver_inbound_ID) + if err != nil { + logger.Warning("getIboundClients run failed:", err) + return false, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + + + + jsonString, err := t.BuildJSONForProtocol(inbound.Protocol) + + newInbound := &model.Inbound{ + Id: receiver_inbound_ID, + Settings: jsonString, + } + + + return t.inboundService.AddInboundClient(newInbound) +} + func checkAdmin(tgId int64) bool { - return slices.Contains(adminIds, tgId) + for _, adminId := range adminIds { + if adminId == tgId { + return true + } + } + return false } func (t *Tgbot) SendAnswer(chatId int64, msg string, isAdmin bool) { @@ -915,7 +1328,10 @@ func (t *Tgbot) SendAnswer(chatId int64, msg string, isAdmin bool) { tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.commands")).WithCallbackData(t.encodeQuery("commands")), tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.onlines")).WithCallbackData(t.encodeQuery("onlines")), + ), + tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.allClients")).WithCallbackData(t.encodeQuery("get_inbounds")), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.addClient")).WithCallbackData(t.encodeQuery("add_client")), ), // TODOOOOOOOOOOOOOO: Add restart button here. ) @@ -1161,35 +1577,75 @@ func (t *Tgbot) getInboundUsages() string { } return info } - func (t *Tgbot) getInbounds() (*telego.InlineKeyboardMarkup, error) { inbounds, err := t.inboundService.GetAllInbounds() - var buttons []telego.InlineKeyboardButton - if err != nil { logger.Warning("GetAllInbounds run failed:", err) return nil, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) - } else { - if len(inbounds) > 0 { - for _, inbound := range inbounds { - status := "❌" - if inbound.Enable { - status = "✅" - } - buttons = append(buttons, tu.InlineKeyboardButton(fmt.Sprintf("%v - %v", inbound.Remark, status)).WithCallbackData(t.encodeQuery("get_clients "+strconv.Itoa(inbound.Id)))) - } - } else { - logger.Warning("GetAllInbounds run failed:", err) - return nil, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) - } - } - cols := 0 - if len(buttons) < 6 { - cols = 3 - } else { + + if len(inbounds) == 0 { + logger.Warning("No inbounds found") + return nil, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + + var buttons []telego.InlineKeyboardButton + for _, inbound := range inbounds { + status := "❌" + if inbound.Enable { + status = "✅" + } + callbackData := t.encodeQuery(fmt.Sprintf("%s %d","get_clients", inbound.Id)) + buttons = append(buttons, tu.InlineKeyboardButton(fmt.Sprintf("%v - %v", inbound.Remark, status)).WithCallbackData(callbackData)) + } + + cols := 1 + if len(buttons) >= 6 { cols = 2 } + + keyboard := tu.InlineKeyboardGrid(tu.InlineKeyboardCols(cols, buttons...)) + return keyboard, nil +} + +func (t *Tgbot) getInboundsAddClient() (*telego.InlineKeyboardMarkup, error) { + inbounds, err := t.inboundService.GetAllInbounds() + if err != nil { + logger.Warning("GetAllInbounds run failed:", err) + return nil, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + + if len(inbounds) == 0 { + logger.Warning("No inbounds found") + return nil, errors.New(t.I18nBot("tgbot.answers.getInboundsFailed")) + } + + excludedProtocols := map[model.Protocol]bool{ + model.DOKODEMO: true, + model.Socks: true, + model.WireGuard: true, + model.HTTP: true, + } + + var buttons []telego.InlineKeyboardButton + for _, inbound := range inbounds { + if excludedProtocols[inbound.Protocol] { + continue + } + + status := "❌" + if inbound.Enable { + status = "✅" + } + callbackData := t.encodeQuery(fmt.Sprintf("%s %d","add_client_to", inbound.Id)) + buttons = append(buttons, tu.InlineKeyboardButton(fmt.Sprintf("%v - %v", inbound.Remark, status)).WithCallbackData(callbackData)) + } + + cols := 1 + if len(buttons) >= 6 { + cols = 2 + } + keyboard := tu.InlineKeyboardGrid(tu.InlineKeyboardCols(cols, buttons...)) return keyboard, nil } @@ -1484,6 +1940,25 @@ func (t *Tgbot) searchClient(chatId int64, email string, messageID ...int) { } } + +func (t *Tgbot) addClient(chatId int64, msg string, messageID ...int) { + + inlineKeyboard := tu.InlineKeyboard( + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.change_default")).WithCallbackData("add_client_ch_default"), + ), + tu.InlineKeyboardRow( + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), + ), + ) + if len(messageID) > 0 { + t.editMessageTgBot(chatId, messageID[0], msg, inlineKeyboard) + } else { + t.SendMsgToTgbot(chatId, msg, inlineKeyboard) + } +} + func (t *Tgbot) searchInbound(chatId int64, remark string) { inbounds, err := t.inboundService.SearchInbounds(remark) if err != nil { @@ -1689,7 +2164,12 @@ func (t *Tgbot) notifyExhausted() { } func int64Contains(slice []int64, item int64) bool { - return slices.Contains(slice, item) + for _, s := range slice { + if s == item { + return true + } + } + return false } func (t *Tgbot) onlineClients(chatId int64, messageID ...int) { @@ -1848,4 +2328,4 @@ func (t *Tgbot) editMessageTgBot(chatId int64, messageID int, text string, inlin if _, err := bot.EditMessageText(¶ms); err != nil { logger.Warning(err) } -} +} \ No newline at end of file diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 37e9eb8c..4e9fa0bf 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -577,6 +577,22 @@ "yes" = "✅ Yes" "no" = "❌ No" +"received_id" = "🔑📥 Received ID: {{ .ClientId }}" +"received_password" = "🔑📥 Received Password: {{ .ClientPass }}" +"received_email" = "📧📥 Received Email: {{ .ClientEmail }}" +"received_comment" = "💬📥 Received Comment: {{ .ClientComment }}" +"id_prompt" = "🔑 Default ID: {{ .ClientId }}\n\nEnter your id." +"pass_prompt" = "🔑 Default Password: {{ .ClientPassword }}\n\nEnter your password." +"email_prompt" = "📧 Default Email: {{ .ClientEmail }}\n\nEnter your email." +"comment_prompt" = "💬 Default Comment: {{ .ClientComment }}\n\nEnter your Comment." +"inbound_client_data_id" = "🔄 Inbound: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Comment: {{ .ClientComment }}\n\nYou can add the client to inbound now!" +"inbound_client_data_pass" = "🔄 Inbound: {{ .InboundRemark }}\n\n🔑 Password: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Comment: {{ .ClientComment }}\n\nYou can add the client to inbound now!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Comment: {{ .ClientComment }}\n\nYou can add the client to inbound now!" +"client_data_pass" = "🔑 Password: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Comment: {{ .ClientComment }}\n\nYou can add the client to inbound now!" +"cancel" = "❌ Process Canceled! \n\nYou can /start again anytime. 🔄" +"error_add_client" = "⚠️ Error:\n\n {{ .error }}" +"success_add_client" = "🏆 Success! \nYou can now modify it using the 'All Clients' inline button." + [tgbot.buttons] "closeKeyboard" = "❌ Close Keyboard" "cancel" = "❌ Cancel" @@ -611,6 +627,11 @@ "getBanLogs" = "Get Ban Logs" "allClients" = "All Clients" +"addClient" = "Add Client" +"submitDisable" = "Submit As Disable ✅" +"use_default" = "🏷️ Use default" +"change_default" = "🔄⚙️ Change Default" + [tgbot.answers] "successfulOperation" = "✅ Operation successful!" "errorOperation" = "❗ Error in operation." diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index 29e099e8..c95f9be3 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -579,6 +579,23 @@ "yes" = "✅ Sí" "no" = "❌ No" +"received_id" = "🔑📥 ID recibido: {{ .ClientId }}" +"received_password" = "🔑📥 Contraseña recibida: {{ .ClientPass }}" +"received_email" = "📧📥 Correo electrónico recibido: {{ .ClientEmail }}" +"received_comment" = "💬📥 Comentario recibido: {{ .ClientComment }}" +"id_prompt" = "🔑 ID predeterminado: {{ .ClientId }}\n\nIntroduce tu ID." +"pass_prompt" = "🔑 Contraseña predeterminada: {{ .ClientPassword }}\n\nIntroduce tu contraseña." +"email_prompt" = "📧 Correo electrónico predeterminado: {{ .ClientEmail }}\n\nIntroduce tu correo electrónico." +"comment_prompt" = "💬 Comentario predeterminado: {{ .ClientComment }}\n\nIntroduce tu comentario." +"inbound_client_data_id" = "🔄 Inbound: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Correo electrónico: {{ .ClientEmail }}\n💬 Comentario: {{ .ClientComment }}\n\n¡Ahora puedes agregar al cliente a inbound!" +"inbound_client_data_pass" = "🔄 Inbound: {{ .InboundRemark }}\n\n🔑 Contraseña: {{ .ClientPass }}\n📧 Correo electrónico: {{ .ClientEmail }}\n💬 Comentario: {{ .ClientComment }}\n\n¡Ahora puedes agregar al cliente a inbound!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Correo electrónico: {{ .ClientEmail }}\n💬 Comentario: {{ .ClientComment }}\n\n¡Ahora puedes agregar al cliente a inbound!" +"client_data_pass" = "🔑 Contraseña: {{ .ClientPass }}\n📧 Correo electrónico: {{ .ClientEmail }}\n💬 Comentario: {{ .ClientComment }}\n\n¡Ahora puedes agregar al cliente a inbound!" +"cancel" = "❌ ¡Proceso cancelado! \n\nPuedes usar /start en cualquier momento. 🔄" +"error_add_client" = "⚠️ Error:\n\n {{ .error }}" +"success_add_client" = "🏆 ¡Éxito! \nAhora puedes modificarlo usando el botón en línea 'Todos los Clientes'." + + [tgbot.buttons] "closeKeyboard" = "❌ Cerrar Teclado" "cancel" = "❌ Cancelar" @@ -613,6 +630,11 @@ "getBanLogs" = "Registros de prohibición" "allClients" = "Todos los Clientes" +"addClient" = "Añadir Cliente" +"submitDisable" = "Enviar como Deshabilitado ✅" +"use_default" = "🏷️ Usar por defecto" +"change_default" = "🔄⚙️ Cambiar por defecto" + [tgbot.answers] "successfulOperation" = "✅ ¡Exitosa!" "errorOperation" = "❗ Error en la Operación." diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 4a1e4177..bf3ea784 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -579,6 +579,23 @@ "yes" = "✅ بله" "no" = "❌ خیر" +"received_id" = "🔑📥 شناسه دریافت شده: {{ .ClientId }}" +"received_password" = "🔑📥 رمز عبور دریافت شده: {{ .ClientPass }}" +"received_email" = "📧📥 ایمیل دریافت شده: {{ .ClientEmail }}" +"received_comment" = "💬📥 نظر دریافت شده: {{ .ClientComment }}" +"id_prompt" = "🔑 شناسه پیش‌فرض: {{ .ClientId }}\n\nشناسه خود را وارد کنید." +"pass_prompt" = "🔑 رمز عبور پیش‌فرض: {{ .ClientPassword }}\n\nرمز عبور خود را وارد کنید." +"email_prompt" = "📧 ایمیل پیش‌فرض: {{ .ClientEmail }}\n\nایمیل خود را وارد کنید." +"comment_prompt" = "💬 نظر پیش‌فرض: {{ .ClientComment }}\n\nنظر خود را وارد کنید." +"inbound_client_data_id" = "🔄 ورودی: {{ .InboundRemark }}\n\n🔑 شناسه: {{ .ClientId }}\n📧 ایمیل: {{ .ClientEmail }}\n💬 نظر: {{ .ClientComment }}\n\nاکنون می‌توانید مشتری را به ورودی اضافه کنید!" +"inbound_client_data_pass" = "🔄 ورودی: {{ .InboundRemark }}\n\n🔑 رمز عبور: {{ .ClientPass }}\n📧 ایمیل: {{ .ClientEmail }}\n💬 نظر: {{ .ClientComment }}\n\nاکنون می‌توانید مشتری را به ورودی اضافه کنید!" +"client_data_id" = "🔑 شناسه: {{ .ClientId }}\n📧 ایمیل: {{ .ClientEmail }}\n💬 نظر: {{ .ClientComment }}\n\nاکنون می‌توانید مشتری را به ورودی اضافه کنید!" +"client_data_pass" = "🔑 رمز عبور: {{ .ClientPass }}\n📧 ایمیل: {{ .ClientEmail }}\n💬 نظر: {{ .ClientComment }}\n\nاکنون می‌توانید مشتری را به ورودی اضافه کنید!" +"cancel" = "❌ فرایند لغو شد! \n\nشما می‌توانید هر زمان که خواستید /start را اجرا کنید. 🔄" +"error_add_client" = "⚠️ خطا:\n\n {{ .error }}" +"success_add_client" = "🏆 موفقیت! اکنون می‌توانید آن را از طریق دکمه 'همه مشتریان' ویرایش کنید." + + [tgbot.buttons] "closeKeyboard" = "❌ بستن کیبورد" "cancel" = "❌ لغو" @@ -613,6 +630,11 @@ "getBanLogs" = "گزارش های بلوک را دریافت کنید" "allClients" = "همه مشتریان" +"addClient" = "افزودن مشتری" +"submitDisable" = "ارسال به عنوان غیرفعال ✅" +"use_default" = "🏷️ استفاده از پیش‌فرض" +"change_default" = "🔄⚙️ تغییر پیش‌فرض" + [tgbot.answers] "successfulOperation" = "✅ انجام شد!" "errorOperation" = "❗ خطا در عملیات." diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index 9d129830..8ef744fc 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -578,6 +578,24 @@ "yes" = "✅ Ya" "no" = "❌ Tidak" + +"received_id" = "🔑📥 ID yang diterima: {{ .ClientId }}" +"received_password" = "🔑📥 Kata sandi yang diterima: {{ .ClientPass }}" +"received_email" = "📧📥 Email yang diterima: {{ .ClientEmail }}" +"received_comment" = "💬📥 Komentar yang diterima: {{ .ClientComment }}" +"id_prompt" = "🔑 ID Default: {{ .ClientId }}\n\nMasukkan ID Anda." +"pass_prompt" = "🔑 Kata Sandi Default: {{ .ClientPassword }}\n\nMasukkan kata sandi Anda." +"email_prompt" = "📧 Email Default: {{ .ClientEmail }}\n\nMasukkan email Anda." +"comment_prompt" = "💬 Komentar Default: {{ .ClientComment }}\n\nMasukkan komentar Anda." +"inbound_client_data_id" = "🔄 Masuk: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Komentar: {{ .ClientComment }}\n\nAnda dapat menambahkan klien ke inbound sekarang!" +"inbound_client_data_pass" = "🔄 Masuk: {{ .InboundRemark }}\n\n🔑 Kata Sandi: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Komentar: {{ .ClientComment }}\n\nAnda dapat menambahkan klien ke inbound sekarang!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Komentar: {{ .ClientComment }}\n\nAnda dapat menambahkan klien ke inbound sekarang!" +"client_data_pass" = "🔑 Kata Sandi: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Komentar: {{ .ClientComment }}\n\nAnda dapat menambahkan klien ke inbound sekarang!" +"cancel" = "❌ Proses Dibatalkan! \n\nAnda dapat memulai lagi kapan saja dengan /start. 🔄" +"error_add_client" = "⚠️ Kesalahan:\n\n {{ .error }}" +"success_add_client" = "🏆 Berhasil! \nSekarang Anda dapat mengeditnya menggunakan tombol 'Semua Klien'." + + [tgbot.buttons] "closeKeyboard" = "❌ Tutup Papan Ketik" "cancel" = "❌ Batal" @@ -612,6 +630,11 @@ "getBanLogs" = "Dapatkan Log Pemblokiran" "allClients" = "Semua Klien" +"addClient" = "Tambah Klien" +"submitDisable" = "Kirim Sebagai Nonaktif ✅" +"use_default" = "🏷️ Gunakan Default" +"change_default" = "🔄⚙️ Ubah Default" + [tgbot.answers] "successfulOperation" = "✅ Operasi berhasil!" "errorOperation" = "❗ Kesalahan dalam operasi." diff --git a/web/translation/translate.ja_JP.toml b/web/translation/translate.ja_JP.toml index 53d2076c..a70d8eca 100644 --- a/web/translation/translate.ja_JP.toml +++ b/web/translation/translate.ja_JP.toml @@ -579,6 +579,23 @@ "yes" = "✅ はい" "no" = "❌ いいえ" +"received_id" = "🔑📥 受信したID: {{ .ClientId }}" +"received_password" = "🔑📥 受信したパスワード: {{ .ClientPass }}" +"received_email" = "📧📥 受信したメール: {{ .ClientEmail }}" +"received_comment" = "💬📥 受信したコメント: {{ .ClientComment }}" +"id_prompt" = "🔑 デフォルトのID: {{ .ClientId }}\n\nIDを入力してください。" +"pass_prompt" = "🔑 デフォルトのパスワード: {{ .ClientPassword }}\n\nパスワードを入力してください。" +"email_prompt" = "📧 デフォルトのメール: {{ .ClientEmail }}\n\nメールアドレスを入力してください。" +"comment_prompt" = "💬 デフォルトのコメント: {{ .ClientComment }}\n\nコメントを入力してください。" +"inbound_client_data_id" = "🔄 インバウンド: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 メール: {{ .ClientEmail }}\n💬 コメント: {{ .ClientComment }}\n\n今すぐクライアントをインバウンドに追加できます!" +"inbound_client_data_pass" = "🔄 インバウンド: {{ .InboundRemark }}\n\n🔑 パスワード: {{ .ClientPass }}\n📧 メール: {{ .ClientEmail }}\n💬 コメント: {{ .ClientComment }}\n\n今すぐクライアントをインバウンドに追加できます!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 メール: {{ .ClientEmail }}\n💬 コメント: {{ .ClientComment }}\n\n今すぐクライアントをインバウンドに追加できます!" +"client_data_pass" = "🔑 パスワード: {{ .ClientPass }}\n📧 メール: {{ .ClientEmail }}\n💬 コメント: {{ .ClientComment }}\n\n今すぐクライアントをインバウンドに追加できます!" +"cancel" = "❌ プロセスがキャンセルされました!\n\nいつでも /start を使用できます。 🔄" +"error_add_client" = "⚠️ エラー:\n\n {{ .error }}" +"success_add_client" = "🏆 成功!\n「すべてのクライアント」ボタンを使用して、編集できます。" + + [tgbot.buttons] "closeKeyboard" = "❌ キーボードを閉じる" "cancel" = "❌ キャンセル" @@ -613,6 +630,11 @@ "getBanLogs" = "禁止ログ" "allClients" = "すべてのクライアント" +"addClient" = "クライアントを追加" +"submitDisable" = "無効として送信 ✅" +"use_default" = "🏷️ デフォルトを使用" +"change_default" = "🔄⚙️ デフォルトを変更" + [tgbot.answers] "successfulOperation" = "✅ 成功!" "errorOperation" = "❗ 操作エラー。" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index 7f0badb7..46abe06e 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -579,6 +579,23 @@ "yes" = "✅ Sim" "no" = "❌ Não" +"received_id" = "🔑📥 ID recebido: {{ .ClientId }}" +"received_password" = "🔑📥 Senha recebida: {{ .ClientPass }}" +"received_email" = "📧📥 E-mail recebido: {{ .ClientEmail }}" +"received_comment" = "💬📥 Comentário recebido: {{ .ClientComment }}" +"id_prompt" = "🔑 ID padrão: {{ .ClientId }}\n\nDigite seu ID." +"pass_prompt" = "🔑 Senha padrão: {{ .ClientPassword }}\n\nDigite sua senha." +"email_prompt" = "📧 E-mail padrão: {{ .ClientEmail }}\n\nDigite seu e-mail." +"comment_prompt" = "💬 Comentário padrão: {{ .ClientComment }}\n\nDigite seu comentário." +"inbound_client_data_id" = "🔄 Entrada: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 E-mail: {{ .ClientEmail }}\n💬 Comentário: {{ .ClientComment }}\n\nAgora você pode adicionar o cliente à entrada!" +"inbound_client_data_pass" = "🔄 Entrada: {{ .InboundRemark }}\n\n🔑 Senha: {{ .ClientPass }}\n📧 E-mail: {{ .ClientEmail }}\n💬 Comentário: {{ .ClientComment }}\n\nAgora você pode adicionar o cliente à entrada!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 E-mail: {{ .ClientEmail }}\n💬 Comentário: {{ .ClientComment }}\n\nAgora você pode adicionar o cliente à entrada!" +"client_data_pass" = "🔑 Senha: {{ .ClientPass }}\n📧 E-mail: {{ .ClientEmail }}\n💬 Comentário: {{ .ClientComment }}\n\nAgora você pode adicionar o cliente à entrada!" +"cancel" = "❌ Processo cancelado! \n\nVocê pode usar /start a qualquer momento. 🔄" +"error_add_client" = "⚠️ Erro:\n\n {{ .error }}" +"success_add_client" = "🏆 Sucesso! \nAgora você pode editá-lo usando o botão 'Todos os Clientes'." + + [tgbot.buttons] "closeKeyboard" = "❌ Fechar teclado" "cancel" = "❌ Cancelar" @@ -613,6 +630,11 @@ "getBanLogs" = "Obter logs de banimento" "allClients" = "Todos os clientes" +"addClient" = "Adicionar Cliente" +"submitDisable" = "Enviar como Desativado ✅" +"use_default" = "🏷️ Usar padrão" +"change_default" = "🔄⚙️ Alterar Padrão" + [tgbot.answers] "successfulOperation" = "✅ Operação bem-sucedida!" "errorOperation" = "❗ Erro na operação." diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 5be87e09..26d62474 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -579,6 +579,23 @@ "yes" = "✅ Да" "no" = "❌ Нет" +"received_id" = "🔑📥 Полученный ID: {{ .ClientId }}" +"received_password" = "🔑📥 Полученный пароль: {{ .ClientPass }}" +"received_email" = "📧📥 Полученный email: {{ .ClientEmail }}" +"received_comment" = "💬📥 Полученный комментарий: {{ .ClientComment }}" +"id_prompt" = "🔑 Стандартный ID: {{ .ClientId }}\n\nВведите ваш ID." +"pass_prompt" = "🔑 Стандартный пароль: {{ .ClientPassword }}\n\nВведите ваш пароль." +"email_prompt" = "📧 Стандартный email: {{ .ClientEmail }}\n\nВведите ваш email." +"comment_prompt" = "💬 Стандартный комментарий: {{ .ClientComment }}\n\nВведите ваш комментарий." +"inbound_client_data_id" = "🔄 Входящий: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Комментарий: {{ .ClientComment }}\n\nТеперь вы можете добавить клиента во входящие!" +"inbound_client_data_pass" = "🔄 Входящий: {{ .InboundRemark }}\n\n🔑 Пароль: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Комментарий: {{ .ClientComment }}\n\nТеперь вы можете добавить клиента во входящие!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Комментарий: {{ .ClientComment }}\n\nТеперь вы можете добавить клиента во входящие!" +"client_data_pass" = "🔑 Пароль: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Комментарий: {{ .ClientComment }}\n\nТеперь вы можете добавить клиента во входящие!" +"cancel" = "❌ Процесс отменен! \n\nВы можете начать заново в любое время с помощью /start. 🔄" +"error_add_client" = "⚠️ Ошибка:\n\n {{ .error }}" +"success_add_client" = "🏆 Успех! \nТеперь вы можете изменить его, используя кнопку 'Все клиенты'." + + [tgbot.buttons] "closeKeyboard" = "❌ Закрыть клавиатуру" "cancel" = "❌ Отмена" @@ -613,6 +630,11 @@ "getBanLogs" = "Логи блокировок" "allClients" = "Все клиенты" +"addClient" = "Добавить клиента" +"submitDisable" = "Отправить как отключено ✅" +"use_default" = "🏷️ Использовать по умолчанию" +"change_default" = "🔄⚙️ Изменить по умолчанию" + [tgbot.answers] "successfulOperation" = "✅ Успешно!" "errorOperation" = "❗ Ошибка в операции." diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index 59149d78..32e849fb 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -579,6 +579,23 @@ "yes" = "✅ Evet" "no" = "❌ Hayır" +"received_id" = "🔑📥 Alınan Kimlik: {{ .ClientId }}" +"received_password" = "🔑📥 Alınan Şifre: {{ .ClientPass }}" +"received_email" = "📧📥 Alınan E-posta: {{ .ClientEmail }}" +"received_comment" = "💬📥 Alınan Yorum: {{ .ClientComment }}" +"id_prompt" = "🔑 Varsayılan Kimlik: {{ .ClientId }}\n\nKimliğinizi girin." +"pass_prompt" = "🔑 Varsayılan Şifre: {{ .ClientPassword }}\n\nŞifrenizi girin." +"email_prompt" = "📧 Varsayılan E-posta: {{ .ClientEmail }}\n\nE-posta adresinizi girin." +"comment_prompt" = "💬 Varsayılan Yorum: {{ .ClientComment }}\n\nYorumunuzu girin." +"inbound_client_data_id" = "🔄 Gelen: {{ .InboundRemark }}\n\n🔑 Kimlik: {{ .ClientId }}\n📧 E-posta: {{ .ClientEmail }}\n💬 Yorum: {{ .ClientComment }}\n\nArtık müşteriyi gelen kutusuna ekleyebilirsiniz!" +"inbound_client_data_pass" = "🔄 Gelen: {{ .InboundRemark }}\n\n🔑 Şifre: {{ .ClientPass }}\n📧 E-posta: {{ .ClientEmail }}\n💬 Yorum: {{ .ClientComment }}\n\nArtık müşteriyi gelen kutusuna ekleyebilirsiniz!" +"client_data_id" = "🔑 Kimlik: {{ .ClientId }}\n📧 E-posta: {{ .ClientEmail }}\n💬 Yorum: {{ .ClientComment }}\n\nArtık müşteriyi gelen kutusuna ekleyebilirsiniz!" +"client_data_pass" = "🔑 Şifre: {{ .ClientPass }}\n📧 E-posta: {{ .ClientEmail }}\n💬 Yorum: {{ .ClientComment }}\n\nArtık müşteriyi gelen kutusuna ekleyebilirsiniz!" +"cancel" = "❌ İşlem iptal edildi! \n\nİstediğiniz zaman /start kullanabilirsiniz. 🔄" +"error_add_client" = "⚠️ Hata:\n\n {{ .error }}" +"success_add_client" = "🏆 Başarılı! \nArtık 'Tüm Müşteriler' düğmesini kullanarak düzenleyebilirsiniz." + + [tgbot.buttons] "closeKeyboard" = "❌ Klavyeyi Kapat" "cancel" = "❌ İptal" @@ -613,6 +630,11 @@ "getBanLogs" = "Yasak Günlüklerini Al" "allClients" = "Tüm Müşteriler" +"addClient" = "Müşteri Ekle" +"submitDisable" = "Devre Dışı Olarak Gönder ✅" +"use_default" = "🏷️ Varsayılanı Kullan" +"change_default" = "🔄⚙️ Varsayılanı Değiştir" + [tgbot.answers] "successfulOperation" = "✅ İşlem başarılı!" "errorOperation" = "❗ İşlemde hata." diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index eb9e93fc..330ae7d4 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -579,6 +579,23 @@ "yes" = "✅ Так" "no" = "❌ Ні" +"received_id" = "🔑📥 Отриманий ID: {{ .ClientId }}" +"received_password" = "🔑📥 Отриманий пароль: {{ .ClientPass }}" +"received_email" = "📧📥 Отриманий email: {{ .ClientEmail }}" +"received_comment" = "💬📥 Отриманий коментар: {{ .ClientComment }}" +"id_prompt" = "🔑 Стандартний ID: {{ .ClientId }}\n\nВведіть ваш ID." +"pass_prompt" = "🔑 Стандартний пароль: {{ .ClientPassword }}\n\nВведіть ваш пароль." +"email_prompt" = "📧 Стандартний email: {{ .ClientEmail }}\n\nВведіть ваш email." +"comment_prompt" = "💬 Стандартний коментар: {{ .ClientComment }}\n\nВведіть ваш коментар." +"inbound_client_data_id" = "🔄 Вхідні: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Коментар: {{ .ClientComment }}\n\nТепер ви можете додати клієнта до вхідних!" +"inbound_client_data_pass" = "🔄 Вхідні: {{ .InboundRemark }}\n\n🔑 Пароль: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Коментар: {{ .ClientComment }}\n\nТепер ви можете додати клієнта до вхідних!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Коментар: {{ .ClientComment }}\n\nТепер ви можете додати клієнта до вхідних!" +"client_data_pass" = "🔑 Пароль: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Коментар: {{ .ClientComment }}\n\nТепер ви можете додати клієнта до вхідних!" +"cancel" = "❌ Процес скасовано! \n\nВи можете використати /start у будь-який час. 🔄" +"error_add_client" = "⚠️ Помилка:\n\n {{ .error }}" +"success_add_client" = "🏆 Успіх! \nТепер ви можете редагувати його за допомогою кнопки 'Усі клієнти'." + + [tgbot.buttons] "closeKeyboard" = "❌ Закрити клавіатуру" "cancel" = "❌ Скасувати" @@ -613,6 +630,11 @@ "getBanLogs" = "Отримати журнали заборон" "allClients" = "Всі Клієнти" +"addClient" = "Додати клієнта" +"submitDisable" = "Надіслати як вимкнено ✅" +"use_default" = "🏷️ Використати за замовчуванням" +"change_default" = "🔄⚙️ Змінити за замовчуванням" + [tgbot.answers] "successfulOperation" = "✅ Операція успішна!" "errorOperation" = "❗ Помилка в роботі." diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index c938449f..a79bce1c 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -579,6 +579,23 @@ "yes" = "✅ Có" "no" = "❌ Không" +"received_id" = "🔑📥 ID nhận được: {{ .ClientId }}" +"received_password" = "🔑📥 Mật khẩu nhận được: {{ .ClientPass }}" +"received_email" = "📧📥 Email nhận được: {{ .ClientEmail }}" +"received_comment" = "💬📥 Bình luận nhận được: {{ .ClientComment }}" +"id_prompt" = "🔑 ID mặc định: {{ .ClientId }}\n\nNhập ID của bạn." +"pass_prompt" = "🔑 Mật khẩu mặc định: {{ .ClientPassword }}\n\nNhập mật khẩu của bạn." +"email_prompt" = "📧 Email mặc định: {{ .ClientEmail }}\n\nNhập email của bạn." +"comment_prompt" = "💬 Bình luận mặc định: {{ .ClientComment }}\n\nNhập bình luận của bạn." +"inbound_client_data_id" = "🔄 Dữ liệu đến: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Bình luận: {{ .ClientComment }}\n\nBạn có thể thêm khách hàng vào danh sách đến ngay bây giờ!" +"inbound_client_data_pass" = "🔄 Dữ liệu đến: {{ .InboundRemark }}\n\n🔑 Mật khẩu: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Bình luận: {{ .ClientComment }}\n\nBạn có thể thêm khách hàng vào danh sách đến ngay bây giờ!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 Email: {{ .ClientEmail }}\n💬 Bình luận: {{ .ClientComment }}\n\nBạn có thể thêm khách hàng vào danh sách đến ngay bây giờ!" +"client_data_pass" = "🔑 Mật khẩu: {{ .ClientPass }}\n📧 Email: {{ .ClientEmail }}\n💬 Bình luận: {{ .ClientComment }}\n\nBạn có thể thêm khách hàng vào danh sách đến ngay bây giờ!" +"cancel" = "❌ Quá trình đã bị hủy! \n\nBạn có thể sử dụng /start bất cứ lúc nào. 🔄" +"error_add_client" = "⚠️ Lỗi:\n\n {{ .error }}" +"success_add_client" = "🏆 Thành công! \nGiờ đây bạn có thể chỉnh sửa bằng nút 'Tất Cả Khách Hàng'." + + [tgbot.buttons] "closeKeyboard" = "❌ Đóng Bàn Phím" "cancel" = "❌ Hủy" @@ -613,6 +630,11 @@ "getBanLogs" = "Cấm nhật ký" "allClients" = "Tất cả Khách hàng" +"addClient" = "Thêm Khách Hàng" +"submitDisable" = "Gửi Dưới Dạng Tắt ✅" +"use_default" = "🏷️ Sử dụng mặc định" +"change_default" = "🔄⚙️ Thay đổi mặc định" + [tgbot.answers] "successfulOperation" = "✅ Thành công!" "errorOperation" = "❗ Lỗi Trong Quá Trình Thực Hiện." diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 770caed3..f38c3a9d 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -579,6 +579,23 @@ "yes" = "✅ 是的" "no" = "❌ 没有" +"received_id" = "🔑📥 接收到的ID: {{ .ClientId }}" +"received_password" = "🔑📥 接收到的密码: {{ .ClientPass }}" +"received_email" = "📧📥 接收到的电子邮件: {{ .ClientEmail }}" +"received_comment" = "💬📥 接收到的评论: {{ .ClientComment }}" +"id_prompt" = "🔑 默认ID: {{ .ClientId }}\n\n请输入您的ID。" +"pass_prompt" = "🔑 默认密码: {{ .ClientPassword }}\n\n请输入您的密码。" +"email_prompt" = "📧 默认电子邮件: {{ .ClientEmail }}\n\n请输入您的电子邮件。" +"comment_prompt" = "💬 默认评论: {{ .ClientComment }}\n\n请输入您的评论。" +"inbound_client_data_id" = "🔄 传入数据: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 电子邮件: {{ .ClientEmail }}\n💬 评论: {{ .ClientComment }}\n\n您现在可以将客户添加到传入列表!" +"inbound_client_data_pass" = "🔄 传入数据: {{ .InboundRemark }}\n\n🔑 密码: {{ .ClientPass }}\n📧 电子邮件: {{ .ClientEmail }}\n💬 评论: {{ .ClientComment }}\n\n您现在可以将客户添加到传入列表!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 电子邮件: {{ .ClientEmail }}\n💬 评论: {{ .ClientComment }}\n\n您现在可以将客户添加到传入列表!" +"client_data_pass" = "🔑 密码: {{ .ClientPass }}\n📧 电子邮件: {{ .ClientEmail }}\n💬 评论: {{ .ClientComment }}\n\n您现在可以将客户添加到传入列表!" +"cancel" = "❌ 过程已取消!\n\n您可以随时使用 /start。 🔄" +"error_add_client" = "⚠️ 错误:\n\n {{ .error }}" +"success_add_client" = "🏆 成功!\n您现在可以使用'所有客户'按钮进行修改。" + + [tgbot.buttons] "closeKeyboard" = "❌ 关闭键盘" "cancel" = "❌ 取消" @@ -613,6 +630,11 @@ "getBanLogs" = "禁止日志" "allClients" = "所有客户" +"addClient" = "添加客户" +"submitDisable" = "提交为禁用 ✅" +"use_default" = "🏷️ 使用默认" +"change_default" = "🔄⚙️ 更改默认" + [tgbot.answers] "successfulOperation" = "✅ 成功!" "errorOperation" = "❗ 操作错误。" diff --git a/web/translation/translate.zh_TW.toml b/web/translation/translate.zh_TW.toml index 0ad36d27..93f5b34a 100644 --- a/web/translation/translate.zh_TW.toml +++ b/web/translation/translate.zh_TW.toml @@ -579,6 +579,23 @@ "yes" = "✅ 是的" "no" = "❌ 沒有" +"received_id" = "🔑📥 接收到的 ID: {{ .ClientId }}" +"received_password" = "🔑📥 接收到的密碼: {{ .ClientPass }}" +"received_email" = "📧📥 接收到的電子郵件: {{ .ClientEmail }}" +"received_comment" = "💬📥 接收到的評論: {{ .ClientComment }}" +"id_prompt" = "🔑 預設 ID: {{ .ClientId }}\n\n請輸入您的 ID。" +"pass_prompt" = "🔑 預設密碼: {{ .ClientPassword }}\n\n請輸入您的密碼。" +"email_prompt" = "📧 預設電子郵件: {{ .ClientEmail }}\n\n請輸入您的電子郵件。" +"comment_prompt" = "💬 預設評論: {{ .ClientComment }}\n\n請輸入您的評論。" +"inbound_client_data_id" = "🔄 傳入數據: {{ .InboundRemark }}\n\n🔑 ID: {{ .ClientId }}\n📧 電子郵件: {{ .ClientEmail }}\n💬 評論: {{ .ClientComment }}\n\n您現在可以將客戶添加到傳入列表!" +"inbound_client_data_pass" = "🔄 傳入數據: {{ .InboundRemark }}\n\n🔑 密碼: {{ .ClientPass }}\n📧 電子郵件: {{ .ClientEmail }}\n💬 評論: {{ .ClientComment }}\n\n您現在可以將客戶添加到傳入列表!" +"client_data_id" = "🔑 ID: {{ .ClientId }}\n📧 電子郵件: {{ .ClientEmail }}\n💬 評論: {{ .ClientComment }}\n\n您現在可以將客戶添加到傳入列表!" +"client_data_pass" = "🔑 密碼: {{ .ClientPass }}\n📧 電子郵件: {{ .ClientEmail }}\n💬 評論: {{ .ClientComment }}\n\n您現在可以將客戶添加到傳入列表!" +"cancel" = "❌ 過程已取消!\n\n您可以隨時使用 /start。 🔄" +"error_add_client" = "⚠️ 錯誤:\n\n {{ .error }}" +"success_add_client" = "🏆 成功!\n您現在可以使用'所有客戶'按鈕進行修改。" + + [tgbot.buttons] "closeKeyboard" = "❌ 關閉鍵盤" "cancel" = "❌ 取消" @@ -613,6 +630,11 @@ "getBanLogs" = "禁止日誌" "allClients" = "所有客戶" +"addClient" = "新增客戶" +"submitDisable" = "提交為停用 ✅" +"use_default" = "🏷️ 使用預設" +"change_default" = "🔄⚙️ 更改預設" + [tgbot.answers] "successfulOperation" = "✅ 成功!" "errorOperation" = "❗ 操作錯誤。"