feat(menu): sort Telegram command suggestions by name

The command menu was in module load order, which split related commands across modules. Sorting by name keeps /thoitiet next to /thoitiethomnay. The weather module also lists /thoitiet first so /help matches.
This commit is contained in:
tiennm99 committed 2026-10-08 17:10:42 +07:00
1 parent 9801a64e18
commit fe552f43e4
4 files changed
+9 -6

No files matched your search

+2 -2
View File
@@ -16,7 +16,7 @@ import (
"github.com/tiennm99/tiennm99bot/internal/testutil"
)
func TestBotCommandMenu_UsesLoadedPublicCommandsInModuleOrder(t *testing.T) {
func TestBotCommandMenu_ListsLoadedPublicCommandsByName(t *testing.T) {
reg := &modules.Registry{
Modules: []modules.Module{
{
@@ -39,8 +39,8 @@ func TestBotCommandMenu_UsesLoadedPublicCommandsInModuleOrder(t *testing.T) {
got := botCommandMenu(reg)
want := []models.BotCommand{
{Command: "beta_public", Description: "<value>. Beta public."},
{Command: "alpha_public", Description: "Alpha public."},
{Command: "beta_public", Description: "<value>. Beta public."},
}
if len(got) != len(want) {
t.Fatalf("commands = %v, want %v", got, want)