Skip to content
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

Add sugar for command kind command@botName #746

Open
tamtakoe opened this issue Jan 20, 2025 · 1 comment
Open

Add sugar for command kind command@botName #746

tamtakoe opened this issue Jan 20, 2025 · 1 comment

Comments

@tamtakoe
Copy link

If you add your bot to some group and use setMyCommands to create menu then Telegram add bot name to each command name (e.g. command@botName). This case handlers for your commands don't work and you should write something like this

bot.command(['start', `start@${config.botUsername}`], async (ctx) => {
  ...
});

It make sense if bot.command('start', ctx => ...) will handle both start and 'start@myBot' variants and add to ctx bot_name or something like this for command part after the @

@KnorpelSenf
Copy link
Member

It already does.

Note that it only handles commands without @ and commands targeted at your bot specifically, not arbitrary other bot names.

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

No branches or pull requests

2 participants