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

Feature Request: Support Throttle and DefaultParseMode adaptors in MockBot #25

Open
janwytze opened this issue Dec 16, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@janwytze
Copy link

janwytze commented Dec 16, 2024

Is your feature request related to a problem? Please describe.

When a handler needs to support a bot that for example throttling, the handler cannot be tested anymore using MockBot, since that initializes a Bot without any adapters.

Describe the solution you'd like
An easy way to enable Throttle and ParseMode on a MockBot.

Describe alternatives you've considered

This does seem to fix my test, but it is not very pretty.

let bot = MockBot::new(msg, handler_tree());

let adaptor_bot = bot
    .bot
    .clone()
    .throttle(Limits::default())
    .parse_mode(ParseMode::MarkdownV2)
    .clone();

bot.dependencies(dptree::deps![adaptor_bot]);
@janwytze janwytze added the enhancement New feature or request label Dec 16, 2024
@LasterAlex
Copy link
Owner

That is actually a valid thing i never considered, and that will probably require a lot of work to be usable, but that is very fair, and it needs to be testable. I'll think on the implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants