mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-14 10:18:59 +00:00
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:
1 parent
9801a64e18
commit
fe552f43e4
4 files changed
+9
-6
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user