feat: add command list in telegram bot (#3027)

This commit is contained in:
spatiumstas authored and GitHub committed 2025-05-28 15:26:29 +07:00 Unverified
1 parent 5dae785786
commit 29f950046a
14 files changed
+71 -6

No files matched your search

+14 -1
View File
@@ -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")),
+4
View File
@@ -588,6 +588,10 @@
"restartSuccess" = "✅ العملية نجحت!"
"restartFailed" = "❗ حصل خطأ في العملية.\r\n\r\n<code>Error: {{ .Error }}</code>."
"xrayNotRunning" = "❗ Xray Core مش شغال."
"startDesc" = "عرض القائمة الرئيسية"
"helpDesc" = "مساعدة البوت"
"statusDesc" = "التحقق من حالة البوت"
"idDesc" = "عرض معرف Telegram الخاص بك"
[tgbot.messages]
"cpuThreshold" = "🔴 حمل المعالج {{ .Percent }}% عدى الحد المسموح ({{ .Threshold }}%)"
+5 -1
View File
@@ -339,7 +339,7 @@
"subEnable" = "Enable Subscription Service"
"subEnableDesc" = "Enables the subscription service."
"subTitle" = "Subscription Title"
"subTitleDesc" = "Title shown in VPN client"
"subTitleDesc" = "Title shown in VPN client"
"subListen" = "Listen IP"
"subListenDesc" = "The IP address for the subscription service. (leave blank to listen on all IPs)"
"subPort" = "Listen Port"
@@ -587,6 +587,10 @@
"restartSuccess" = "✅ Operation successful!"
"restartFailed" = "❗ Error in operation.\r\n\r\n<code>Error: {{ .Error }}</code>."
"xrayNotRunning" = "❗ Xray Core is not running."
"startDesc" = "Show the main menu"
"helpDesc" = "Bot help"
"statusDesc" = "Check bot status"
"idDesc" = "Show your Telegram ID"
[tgbot.messages]
"cpuThreshold" = "🔴 CPU Load {{ .Percent }}% exceeds the threshold of {{ .Threshold }}%"
Loaded 3 of 14 files, more files were not shown because too many files have changed in this diff. Show more