Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions pkg/channels/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
}
Comment on lines +133 to +138
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command registration is happening after the bot is marked as running and after logging "Telegram bot connected". Consider moving this registration to occur before line 128 (before setRunning) and before the "connected" log message. This would ensure all initialization steps complete before the bot is considered operational and would make the "connected" log more accurate. Compare with the Discord channel implementation where bot info is fetched before opening the session.

Copilot uses AI. Check for mistakes.

go bh.Start()

go func() {
Expand All @@ -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 this help message"},
{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")
Expand Down