From fa6a8f9a72244cba3e4c13773ddc7f6887a509c9 Mon Sep 17 00:00:00 2001 From: rfshubert Date: Sun, 22 Feb 2026 23:57:31 -0300 Subject: [PATCH] feat: register Telegram command menu via SetMyCommands Call bot.SetMyCommands() on startup so that Telegram displays the command menu when users press "/" in chat. Registration failure is logged as a warning and does not block bot startup. --- pkg/channels/telegram.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/channels/telegram.go b/pkg/channels/telegram.go index a0a1c8d0a..6c3f0ae96 100644 --- a/pkg/channels/telegram.go +++ b/pkg/channels/telegram.go @@ -130,6 +130,13 @@ func (c *TelegramChannel) Start(ctx context.Context) error { "username": c.bot.Username(), }) + // Register command menu with Telegram + if err := c.registerCommands(ctx); err != nil { + logger.WarnCF("telegram", "Failed to register commands menu", map[string]any{ + "error": err.Error(), + }) + } + go bh.Start() go func() { @@ -146,6 +153,19 @@ func (c *TelegramChannel) Stop(ctx context.Context) error { return nil } +func (c *TelegramChannel) registerCommands(ctx context.Context) error { + commands := []telego.BotCommand{ + {Command: "start", Description: "Start the bot"}, + {Command: "help", Description: "Show available commands"}, + {Command: "show", Description: "Show current configuration"}, + {Command: "list", Description: "List available options"}, + } + + return c.bot.SetMyCommands(ctx, &telego.SetMyCommandsParams{ + Commands: commands, + }) +} + func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) error { if !c.IsRunning() { return fmt.Errorf("telegram bot not running")