Filters for Category and file types#1046
Merged
jh0ker merged 9 commits intopython-telegram-bot:masterfrom Mar 16, 2018
spontanurlaub:master
Merged
Filters for Category and file types#1046jh0ker merged 9 commits intopython-telegram-bot:masterfrom spontanurlaub:master
jh0ker merged 9 commits intopython-telegram-bot:masterfrom
spontanurlaub:master
Conversation
Added extra Filters for File Type and Category, based on the provided Mime-Type
Added Tests for the Category and File Types Filters.
Fixed the Tests from the last commit
Closed
jh0ker
requested changes
Mar 16, 2018
telegram/ext/filters.py
Outdated
| Args: | ||
| category (str, optional): category of the media you want to filter""" | ||
| self.category = category | ||
| self.name = 'Filters.document.category(\'{}\')'.format(self.category) |
Member
There was a problem hiding this comment.
Please use double-quotes on the string instead of escaping single-quotes inside the string
telegram/ext/filters.py
Outdated
| video = category('video/') | ||
| text = category('text/') | ||
|
|
||
| class file_type(BaseFilter): |
Member
There was a problem hiding this comment.
I believe in one of your previous PRs we had agreed to rename this filter to mime_type to prevent misunderstandings. Is there a reason you changed this back?
telegram/ext/filters.py
Outdated
|
|
||
| new_chat_members = _NewChatMembers() | ||
| """:obj:`Filter`: Messages that contain :attr:`telegram.Message.new_chat_members`.""" | ||
| """:obj:`Filter`: Messages that contain :attr:`telegram.Message.new_chat_member`.""" |
telegram/ext/filters.py
Outdated
|
|
||
| Examples: | ||
| Use these filters like: ``Filters.status_update.new_chat_members`` etc. Or use just | ||
| Use these filters like: ``Filters.status_update.new_chat_member`` etc. Or use just |
telegram/ext/filters.py
Outdated
| :attr: `telegram.Message.migrate_from_chat_id`. | ||
| new_chat_members (:obj:`Filter`): Messages that contain | ||
| :attr:`telegram.Message.new_chat_members`. | ||
| :attr:`telegram.Message.new_chat_member`. |
jh0ker
approved these changes
Mar 16, 2018
Member
|
Failing tests are due to unrelated derp, merging... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basically PR #889 , without the file_size Filter.
Filters for file Category and Mime Type, based on the mime_type of the file.
Here is my fixed version of my previous PR. I'm not sure how detailed the tests have to be.