* Improve regex docstring and add test case
* Add Ambro17 as contributor
* rename regex filter
* Fix sphinx documentation for Filters.regex
* Add spacing to render Note with blue background
* BasePersistence
* basic construct
* Keep working
* Continue work
Add tests for Basepersistence
* Finish up BasePersistence and implementation
* PickelPersistence and start tests
* Finishing up
* Oops, left in some typings
* Compatibilty issues regarding py2 solved
For Py2 compatibility
* increasing coverage
* Small changes due to CR
* All persistence tests in one file
* add DictPersistence
* Last changes per CR
* forgot change
* changes per CR
* call update_* only with relevant data
As discussed with @jsmnbom
* Add conversationbot Example
* should not have committed API-key
Telegram Passport (#1174):
- Add full support for telegram passport.
- New types: PassportData, PassportFile, EncryptedPassportElement, EncryptedCredentials, PassportElementError, PassportElementErrorDataField, PassportElementErrorFrontSide, PassportElementErrorReverseSide, PassportElementErrorSelfie, PassportElementErrorFile and PassportElementErrorFiles.
- New bot method: set_passport_data_errors
- New filter: Filters.passport_data
- Field passport_data field on Message
- PassportData is automagically decrypted when you specify your private key when creating Updater or Bot.
- PassportFiles is also automagically decrypted as you download/retrieve them.
- See new passportbot.py example for details on how to use, or go to our telegram passport wiki page for more info
- NOTE: Passport decryption requires new dependency `cryptography`.
Inputfile rework (#1184):
- Change how Inputfile is handled internally
- This allows support for specifying the thumbnails of photos and videos using the thumb= argument in the different send_ methods.
- Also allows Bot.send_media_group to actually finally send more than one media.
- Add thumb to Audio, Video and Videonote
- Add Bot.edit_message_media together with InputMediaAnimation, InputMediaAudio, and inputMediaDocument.
Other Bot API 4.0 changes:
- Add forusquare_type to Venue, InlineQueryResultVenue, InputVenueMessageContent, and Bot.send_venue. (#1170)
- Add vCard support by adding vcard field to Contact, InlineQueryResultContact, InputContactMessageContent, and Bot.send_contact. (#1166)
- Support new message entities: CASHTAG and PHONE_NUMBER. (#1179)
- Cashtag seems to be things like $USD and $GBP, but it seems telegram doesn't currently send them to bots.
- Phone number also seems to have limited support for now
- Add Bot.send_animation, add width, height, and duration to Animation, and add Filters.animation. (#1172)
Co-authored-by: Jasmin Bom <jsmnbom@gmail.com>
Co-authored-by: code1mountain <32801117+code1mountain@users.noreply.github.com>
Co-authored-by: Eldinnie <pieter.schutz+github@gmail.com>
Co-authored-by: mathefreak1 <mathefreak@hi2.in>
* Commandhandler reworked
* Make CommandHandler strict
Only register valid botcommands, else raise ValueError
* Add PrefixHandler
* declare encoding on test_commandhandler
* Fix some tests dependend on CommandHandler
* CR changes
* small docfix.
* Test all possibilities for PrefixHandler
See https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-11.0 under Context based callbacks and Filters in handlers for a good guide on the changes in this commit.
* Change handlers so context is supported
* Attempt to make parameter "guessing" work on py < 3.5
* Document use_context in all handlers
* Add Context to docs
* Minor fixes to context handling
* Add tests for context stuff
* Allow the signature check to work on py<3.5 with methods
* Fix order of operations
* Address most issues raised in CR
* Make CommandHandler no longer support filter lists
* Fix indent
(pycharm can be an arse sometimes)
* Improve readability in conversationhandler
* Make context have Match instead of groups & groupdict
* Remove filter list support from messagehandler too
* Small fix to StringCommandHandler
* More small fixes to handlers
* Amend CHANGES
* Fix tests and fix bugs raised by tests
* Don't allow users to ignore errors without messing with the warning filters themselves
* Ignore our own deprecation warnings when testing
* Skipping deprecationwarning test on py2
* Forgot some changes
* Handler: Improved documentation and text of deprecation warnings
* HandlerContext: Keep only dispatcher and use properties; improved doc
* Complete fixing the documentation.
- Fixes per Eldinnie's comments.
- Fixes per warnings when running sphinx.
* Some small doc fixes (interlinks and optionals)
* Change add_error_handler to use HandlerContext too
* More context based changes
Context Based Handlers -> Context Based Callbacks
No longer use_context args on every single Handler
Instead set dispatcher/updater .use_context=True to use
Works with
- Handler callbacks
- Error handler callbacks
- Job callbacks
Change examples to context based callbacks so new users are not confused
Rename and move the context object from Handlers.HandlerContext to CallbackContext, since it doesn't only apply to handlers anymore.
Fix tests by adding a new fixture `cpd` which is a dispatcher with use_context=True
* Forgot about conversationhandler
* Forgot jobqueue
* Add tests for callbackcontext & for context based callback job
* Fix as per review :)
* Added extra Filters for File Type and Category
Added extra Filters for File Type and Category, based on the provided Mime-Type
* Added tests for the new Filters
Added Tests for the Category and File Types Filters.
* Fixed Tests
Fixed the Tests from the last commit
* Little Fix
* Revert of unwanted changes
* Update filters.py
* Changed the strings
* Changed file_type to mime_type
* Fixed Tests
* Fix conversationhandler
As found by @nmlorg and described in #1031closes#1031
* adding another test and definitely finish conversationhandler
It seems another problem was when the job executed the timeout, it wasn;t removed from `self.conversation_timeouts` which made it still fail because job would be present in the handler dict, although it was already disabled.
This should fix it properly.
TimedOut exception is an expected an normal event. To reduce noise and
make things more "fluent" we now:
- Make sure that we don't sleep after the timeout but rather retry
immediately.
- Log debug instead of error level.
Fixes#802
* Added support for new field `telegram.Message.connected_message`
* Added support for new field `telegram.Message.connected_message`
* Added support for parse_mode in captions
* Added parse_mode parameter for captions in InlineQueryResult*
* Added supports_streaming parameter in telegram.Bot.send_video and telegram.InputMediaVideo
Fixed Docstrings for parse_mode in captions
* pypy3.5 unitests are now running with a new version due internal errors on travis.
closes#1005
- Fix JobQueue.jobs to obtain a lock on the internal queue object prior
to iterating over it.
- Rename JobQueue.queue to JobQueue._queue. This shouldn't be
accessible by the user directly, but rather only with sanitized
thread safe methods.
- JobQueue.interval_seconds - access self.interval only once to avoid
race conditions.
Fixes#968