Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add condition asserting str is in Message.text (#335)
# Description - Function has_text() added. Checks the 'text' field of last_request(), if specified text within 'text' field, returns true. For such a task it's quicker than regexp condition and has less syntax bloat than exact_match() would have. This also makes checking telegram callback data easier since it is saved in the 'text' field: has_text(callback_data). - All relevant API reference / tutorials / guides updated. By that I mean all 'exact_match(Message("Some message"))' was changed into 'has_text("Some message")'. - All relevant references in the codebase updated. - Tests added, but I'm not sure I did it right. I changed some exact_match() uses to has_text() there. Well, vim did it, and now I'm thinking it's maybe preferable, actually. # Checklist - [x] I have performed a self-review of the changes - [x] Check if tests are done right (poetry has no issues, I mean if exact_match() should return instead of has_text()) # To Consider - Consider if exact_match() could somehow be used in tandem with has_text() in the tutorials. It's a part of functionality that new users can't really see now, since it's rarely used (mostly in telegram tutorials). --------- Co-authored-by: Roman Zlobin <[email protected]>
- Loading branch information