mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-04 12:36:37 +08:00
Hide duplicate Telegram bot command aliases
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user