-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Overhaul of Filters #2759
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
Overhaul of Filters #2759
Conversation
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>
Signed-off-by: starry69 <starry369126@outlook.com> Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com> Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com>
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.
nice updates! I left a number of more comments though I'd classify most of them as nitpicking by now 😃
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.
One detail, otherwise I'm happy :)
IIRC you'll sort the contents of filters.py
now, right?
I'll force-push v14 to include the master changes later tonight.
If you want to, this could be a good chance to get to know rebasing :D basically, you (pull v14 and) run git rebase v14
and follow the comments in the command line. I guess there should be few to none merge conflicts :)
Alternatively, just merging v14 into this branch is fine as well ofc :)
PS: this article helped me quite well when working with rebase the first time
Breaking changes:
Also fixes #2281 (the problem was that we had duplicate docs in filters.)
Checklist for PRs
AddedHow do we want to document this breaking change? Just a.. versionadded:: version
,.. versionchanged:: version
or.. deprecated:: version
to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes).. versionchanged::
on top of the filters module?Notable changes:
Converted
__new__
inBaseFilter
to__init__
see: Overhaul of Filters #2759 (comment)Made
_UpdateType
public, so users can now do:filters.UpdateType.MESSAGES
.deleted
ChatType
'sfilter()
as discussed offline (reasoning was thatFilters.chat_type
was alwaysTrue
) .All
_ChatUserBaseFilter
subclasses have a CAPS shortcut withallow_empty=True
, we can discuss to remove this / keep it default (False
). This allows a user to do something likefilters.SENDER_CHAT
work for both Channels and Supergroups.Edit: It was decided that those shortcuts won't inherit from
_CUBF
and instead be their own, seehttps://t.me/pythontelegrambotdev/261 for discussion.
Use a.functools.partial()
inDICE
filter to simplify it for the user. See the examples section in Dice docsReverted. See: Overhaul of Filters #2759 (comment)
Minor changes:
_Dice
(to reduce repetition, it is now built from the emoji itself)User
,Chat
infilters
toTG{User, Chat}
to avoid namespace conflicts.Optional[str]
->str
inMimeType
andCategory
(it was just plain wrong).