Hide duplicate Telegram bot command aliases

This commit is contained in:
ShukeBta
2026-06-15 01:43:24 +08:00
parent 9b9f8eae02
commit 03be4df6e2
2 changed files with 15 additions and 2 deletions
+15
View File
@@ -150,6 +150,16 @@ func TestRegisterTelegramBotCommands(t *testing.T) {
}
func TestTelegramCommandMenusSeparateGroupAndAdminCommands(t *testing.T) {
privateNames := telegramCommandNames(telegramPrivateBotCommandMenu())
for _, hiddenAlias := range []string{"myinfo", "count"} {
if privateNames[hiddenAlias] {
t.Fatalf("private menu should hide compatibility alias %s", hiddenAlias)
}
if !telegramSupportedCommand("/" + hiddenAlias) {
t.Fatalf("compatibility alias /%s should remain executable", hiddenAlias)
}
}
groupNames := telegramCommandNames(telegramGroupBotCommandMenu())
for _, forbidden := range []string{"status", "search", "downloads", "stats", "users", "cleanup", "cleanup_rule", "register", "redeem"} {
if groupNames[forbidden] {
@@ -167,6 +177,11 @@ func TestTelegramCommandMenusSeparateGroupAndAdminCommands(t *testing.T) {
t.Fatalf("admin menu should include %s", required)
}
}
for _, hiddenAlias := range []string{"myinfo", "count"} {
if adminNames[hiddenAlias] {
t.Fatalf("admin menu should hide compatibility alias %s", hiddenAlias)
}
}
}
func telegramCommandNames(commands []telegramBotCommand) map[string]bool {
-2
View File
@@ -213,8 +213,6 @@ func telegramPrivateBotCommandMenu() []telegramBotCommand {
{Command: "menu", Description: "打开功能菜单"},
{Command: "help", Description: "查看命令帮助"},
{Command: "account", Description: "查看账号状态"},
{Command: "myinfo", Description: "查看账号状态"},
{Command: "count", Description: "查看媒体库数量"},
{Command: "signin", Description: "签到"},
{Command: "devices", Description: "查看登录设备"},
{Command: "kick", Description: "踢下线设备"},