diff options
| author | spatiumstas <79056064+spatiumstas@users.noreply.github.com> | 2025-05-28 11:26:29 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-28 11:26:29 +0300 |
| commit | 29f950046acfcb5d9c601aa7f484bb3bde0849dc (patch) | |
| tree | 8491d48e3751692f5f6c0a4e6cf5a87b4b63ae8c /web/service | |
| parent | 5dae785786f331b80d35dee12f24677b1e2fb16c (diff) | |
feat: add command list in telegram bot (#3027)
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/tgbot.go | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 2f36697e..ffdb63f9 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -147,6 +147,19 @@ func (t *Tgbot) Start(i18nFS embed.FS) error { return err } + // After bot initialization, set up bot commands with localized descriptions + err = bot.SetMyCommands(&telego.SetMyCommandsParams{ + Commands: []telego.BotCommand{ + {Command: "start", Description: t.I18nBot("tgbot.commands.startDesc")}, + {Command: "help", Description: t.I18nBot("tgbot.commands.helpDesc")}, + {Command: "status", Description: t.I18nBot("tgbot.commands.statusDesc")}, + {Command: "id", Description: t.I18nBot("tgbot.commands.idDesc")}, + }, + }) + if err != nil { + logger.Warning("Failed to set bot commands:", err) + } + // Start receiving Telegram bot messages if !isRunning { logger.Info("Telegram bot receiver started") @@ -935,7 +948,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.cancel")).WithCallbackData(t.encodeQuery("add_client_default_traffic_exp")), ), tu.InlineKeyboardRow( - tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.confirmNumber", "Num=="+strconv.Itoa(inputNumber))).WithCallbackData(t.encodeQuery("add_client_reset_exp_c "+strconv.Itoa(inputNumber))), + tu.InlineKeyboardButton(t.I18nBot("tgbot.buttons.confirmNumberAdd", "Num=="+strconv.Itoa(inputNumber))).WithCallbackData(t.encodeQuery("add_client_reset_exp_c "+strconv.Itoa(inputNumber))), ), tu.InlineKeyboardRow( tu.InlineKeyboardButton("1").WithCallbackData(t.encodeQuery("add_client_reset_exp_in "+strconv.Itoa(inputNumber)+" 1")), |
