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: Automatic update filtering #389

Closed
WaffleLapkin opened this issue May 27, 2021 · 1 comment · Fixed by #403
Closed

Feature Request: Automatic update filtering #389

WaffleLapkin opened this issue May 27, 2021 · 1 comment · Fixed by #403
Assignees
Labels
feature-accepted Feature Request or Proposal was accepted by maintainers and will be implemented K-feature-request Kind: request for implementing a feature
Milestone

Comments

@WaffleLapkin
Copy link
Member

WaffleLapkin commented May 27, 2021

Both GetUpdates and SetWebhook methods accept the allowed_updates parameter which allows filtering updates that are not needed. Teloxide should automatically check which handlers are set up, and set allowed_updates to an appropriate value.

I propose adding the following method to the UpdateListener trait:

fn hint_allowed_updates(&mut self, hint: impl IntoIterator<Item = AllowedUpdate>);

(cc @Hirrolot should I do this in #385, or should I make a new PR for that?)

Pros

Users won't need to provide allowed_updates by themself and so won't make a mistake providing allowed_updates with redundant update types or without wanted update types.

Cons

None known.

@WaffleLapkin WaffleLapkin added the K-feature-request Kind: request for implementing a feature label May 27, 2021
@Hirrolot
Copy link
Collaborator

Hirrolot commented May 28, 2021

LGTM.
I think we should do it in a separate PR since this is quite different functionality.

@Hirrolot Hirrolot added the feature-accepted Feature Request or Proposal was accepted by maintainers and will be implemented label May 28, 2021
@WaffleLapkin WaffleLapkin added this to the 0.5 milestone Jun 18, 2021
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-feature-request Kind: request for implementing a feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants