From be8d55dadbd65d6e0a80209dc9952d3c56074646 Mon Sep 17 00:00:00 2001 From: nistootsin <104831639+nistootsin@users.noreply.github.com> Date: Wed, 16 Apr 2025 11:46:55 +0330 Subject: feat: add `Submit As Enable` in telegram bot --- web/service/tgbot.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'web/service') diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 2fbe6cb4..2c572192 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -1413,6 +1413,16 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool t.deleteMessageTgBot(chatId, callbackQuery.Message.GetMessageID()) t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.successfulOperation"), tu.ReplyKeyboardRemove()) } + case "add_client_submit_enable": + client_Enable = true + _, 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.deleteMessageTgBot(chatId, callbackQuery.Message.GetMessageID()) + t.SendMsgToTgbot(chatId, t.I18nBot("tgbot.answers.successfulOperation"), tu.ReplyKeyboardRemove()) + } } } @@ -2216,6 +2226,9 @@ func (t *Tgbot) addClient(chatId int64, msg string, messageID ...int) { ), tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitEnable")).WithCallbackData("add_client_submit_enable"), + ), + tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), ), ) @@ -2239,6 +2252,9 @@ func (t *Tgbot) addClient(chatId int64, msg string, messageID ...int) { ), tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitEnable")).WithCallbackData("add_client_submit_enable"), + ), + tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), ), ) @@ -2262,6 +2278,9 @@ func (t *Tgbot) addClient(chatId int64, msg string, messageID ...int) { ), tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitDisable")).WithCallbackData("add_client_submit_disable"), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.submitEnable")).WithCallbackData("add_client_submit_enable"), + ), + tu.InlineKeyboardRow( tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData("add_client_cancel"), ), ) -- cgit v1.2.3