-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Filters for Category and file types #1046
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
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
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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`.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change
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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this change
|
Failing tests are due to unrelated derp, merging... |
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.