Skip to content

Feature/33 update filter #1045

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

Merged
merged 6 commits into from
Jun 6, 2020
Merged

Feature/33 update filter #1045

merged 6 commits into from
Jun 6, 2020

Conversation

VRciF
Copy link
Contributor

@VRciF VRciF commented Jan 21, 2020

The goal of this PR is to provide a method to filter update messages using a custom callback which solves #527.

It is mentioned in php-telegram-bot/telegram-bot-manager#33 (comment) that this might be implemented in the telegram bot manager, I don't use the bot manager currently and only need the core running on my raspberry pi.

? !
Type feature
BC Break no
Fixed issues #527

Summary

A new method setUpdateFilter($callback) is introduced.If the $callback returns false, the executed of processUpdate() ends with a ServerResponse where isOk() returns false.
The given test case demonstrates the usage.

@noplanman
Copy link
Member

@VRciF Sorry for this epically late reply...

I like this! Could you please rebase and add a note to the changelog as well?

@php-telegram-bot/developers What do you think about this?

@VRciF
Copy link
Contributor Author

VRciF commented May 21, 2020

@noplanman No worry about the late reply. We're all too busy too often. I've rebased and modified the changelog. Please have a look.

@noplanman
Copy link
Member

@VRciF Thanks so much for this!

I've updated it a bit and added the ability to define a custom reason text to be written to the debug log.

@noplanman noplanman merged commit 808c423 into php-telegram-bot:develop Jun 6, 2020
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

Successfully merging this pull request may close these issues.

2 participants