Skip to content

feat(telegram): Init bot commands on start#300

Merged
yinwm merged 12 commits intosipeed:mainfrom
mymmrac:telegram-bot-commands
Mar 2, 2026
Merged

feat(telegram): Init bot commands on start#300
yinwm merged 12 commits intosipeed:mainfrom
mymmrac:telegram-bot-commands

Conversation

@mymmrac
Copy link
Collaborator

@mymmrac mymmrac commented Feb 16, 2026

This PR adds a setup of Telegram bot commands, so that users will see list of available commands in the bot

@Leeaandrob
Copy link
Collaborator

@Zepan Initializes Telegram bot commands on startup so users see the command menu in the Telegram UI. Good DX improvement.

Recommendation: Merge. +65/-12, clean implementation that improves the Telegram user experience.

Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

Clean implementation with smart rate-limit handling via slices.Equal — avoids unnecessary SetMyCommands calls since Telegram aggressively rate-limits that endpoint.

The lifecycle improvements are also welcome: proper StopWithContext, error logging for bh.Start(), and fixing the swallowed error in the /help handler.

One suggestion (non-blocking): Consider making initBotCommands non-fatal. If there's a transient network error at startup, logging a warning and continuing would be better than failing the entire channel initialization. The bot works fine without the command menu.

if err := c.initBotCommands(ctx); err != nil {
    logger.WarnCF("telegram", "Failed to init bot commands (non-fatal): %v", err)
}

Note: nice that you (the telego library author) are contributing directly — high confidence in the patterns. LGTM.

Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

Clean implementation with smart rate-limit avoidance via slices.Equal. The lifecycle improvements (proper StopWithContext, error logging for bh.Start()) are also welcome.

One suggestion: consider making initBotCommands non-fatal. A transient network error at startup shouldn't prevent the entire channel from initializing — the bot works fine without the command menu:
```go
if err := c.initBotCommands(ctx); err != nil {
logger.WarnCF("telegram", "Failed to init bot commands (non-fatal): %v", err)
}
```

Also great that you're fixing the swallowed error in the /help handler (return c.commands.Help(...) instead of ignoring the return). LGTM.

@lukemilby
Copy link
Contributor

@mymmrac can you add a screenshot of what the user will see

@mymmrac
Copy link
Collaborator Author

mymmrac commented Feb 20, 2026

Looks like this:
image

Copy link
Contributor

@lukemilby lukemilby left a comment

Choose a reason for hiding this comment

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

Looks good.

Copy link
Collaborator

@PixelTux PixelTux left a comment

Choose a reason for hiding this comment

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

Good implementation and nice code cleanup. LGTM.

@alexhoshina alexhoshina added this to the Refactor Channel milestone Feb 26, 2026
@alexhoshina
Copy link
Collaborator

Please develop based on the refactor branch. The refactor branch is about to be merged, and PRs developed based on main before the merge will not be reviewed.

The refactor branch is scheduled to be merged during the daytime of February 28, 2026, Beijing Time (GMT+8), with the exact time yet to be determined. You may wait until after the merge to request a PR review Or complete the review before finishing the merge; I will review your PR as quickly as possible We have provided comprehensive migration documentation for the new channel system.

@yinwm yinwm merged commit 2563916 into sipeed:main Mar 2, 2026
2 checks passed
@yinwm
Copy link
Collaborator

yinwm commented Mar 2, 2026

thanks for the pr

hyperwd pushed a commit to hyperwd/picoclaw that referenced this pull request Mar 5, 2026
feat(telegram): Init bot commands on start
Pluckypan pushed a commit to Pluckypan/picoclaw that referenced this pull request Mar 6, 2026
feat(telegram): Init bot commands on start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants