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

Provide method to get Vec<types::BotCommand> for set_my_commands() #262

Closed
robinhundt opened this issue Aug 11, 2020 · 2 comments
Closed
Assignees
Labels
feature-accepted Feature Request or Proposal was accepted by maintainers and will be implemented K-enhancement Kind: enchantment (new feature or request)

Comments

@robinhundt
Copy link
Contributor

The Telegram API offers the set_my_commands method to set the current commands automatically instead of manually through the BotFather.
This API endpoint is already implemented in the crate (docs) but it accepts a Vec<types::BotCommand>. Currently a user of the library would need to construct these BotCommands themselves. I propose to add a method to the utils::command::BotCommand trait (maybe commands(&self) -> Vec<BotCommand>) which returns a Vec of these BotCommands that can be sent to the API.
This would allow a user of the library to have the BotCommand enum declaration as the single source of truth and automatically send the correct command information to the API via set_my_command.

@robinhundt
Copy link
Contributor Author

I suppose the implementation of that method would be similar to the implementation of the description method here:
https://github.com/teloxide/teloxide-macros/blob/30024d7792b27e1bf9fcdb61c6fe8555d6f0ee2a/src/lib.rs#L260-L296

@p0lunin p0lunin added the K-enhancement Kind: enchantment (new feature or request) label Aug 12, 2020
@p0lunin p0lunin self-assigned this Aug 12, 2020
@Hirrolot Hirrolot added the feature-accepted Feature Request or Proposal was accepted by maintainers and will be implemented label Aug 12, 2020
@Hirrolot Hirrolot changed the title Provide method to get Vec<types::BotCommand> for set_my_commands() Provide method to get Vec<types::BotCommand> for set_my_commands() Jun 27, 2021
@Hirrolot
Copy link
Collaborator

Hirrolot commented Feb 4, 2022

Closed by #498.

@Hirrolot Hirrolot closed this as completed Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-accepted Feature Request or Proposal was accepted by maintainers and will be implemented K-enhancement Kind: enchantment (new feature or request)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants