-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin: BotCommandScope builder #108
Comments
It might be interesting to export the commands to setMyCommands. Some kind of check would be great to ensure only commands are set which are actually implemented in the bot. |
I was thinking to have a method |
If I well undestood, this can use the following syntax...? bot.command
.name("start")
.description("Welcomes first-time users")
.filter(/* Do filtering stuff */)
.defaultDo((ctx) => { /* Everyone */ })
.onPrivateChat((ctx) => { /* Only on PM */ })
.onGroupAdmins((ctx) => { /* Only group admins */ }) |
I do not have a concrete plan for this yet. You're more than welcome to make suggestions! Telegram often has matching concepts that are at different places in the API, where it is convenient to bring things together. Inline keyboards are sent, and callback queries are received. The menu plugin brings this together by letting you define handlers directly alongside your inline keyboard. The commands plugin could bring together two other things, namely setting command scopes and handling command messages. That's as far as I have planned, the rest are good ideas that may or may not fit into the cohesive vision that we need for this plugin. |
Feature suggestion: "Did you mean ...?" for misspelled commands. It could also have a configurable error-help message like we usually see when subcommands are misspelled in CLI applications. |
I think the |
We could compute the Levenshtein distance to all registered commands, and provide |
Create a new repo with a plugin for advanced command filtering that goes beyond what people usually need. This not only allows users to do cooler things, but it also helps the core package stay focused on other things.
Desired features:
ctx.command
property that exposes the invoked command on the context object (useful for what we currently do withbot.command(array)
where it is not possible to find out which command was invoked without inspecting the message text)!
instead of/
commands
The text was updated successfully, but these errors were encountered: