* Clarify InlineKeyboardButton callback-data docstring
Fixes#1267
* Improve documentation slightly
- Prettier changelog
- Link to examples on frontpage
- Link to wiki on frontpage
- Put telegram.ext in own sidebar thingy
* Improve ext.Filters documentation
Superseeds #1089
- Remove `:obj:Filter` as it's pretty obvious that it's a filter since it's in this module. It also made the html output about 1/3 times longer to scroll through.
- Add an __all__ to reorder so Filter is at the top instead of BaseFilter
- Add a proper docstring for document that documents the attributes (this is the #1089 part)
- Also fix a couple of grammar errors.
* Fix indentation in telegram.rst
* Add `git describe --long --tags` to the `python -m telegram` output
* Use admonition for examples to make them *pop* better
* Remove automodule telegram
Sphinx was whining a lot and it doesn't actually seem to be needed in any way?
* Fix Filters.document docstring per CR
Co-Authored-By: jsmnbom <jsmnbom@gmail.com>
* Fix spelling error in docs index
Co-Authored-By: jsmnbom <jsmnbom@gmail.com>
* Setting needs_sphinx to 1.7.9
so we don't have more issues with incongruent versions
* Fixed last warnings
* Make pre-commit happy
* Fix unresolvable promises
* added async test and description
* added test_none_on_first_message for conv_handler
* Small change in ConversationHandler docstring
* Fix test to work with new commandhandler
* Add WAITING state and behavior
* Remove `run_async_timeout` and `timed_out_behavior` arguments
* replace with `WAITING` constant and behavior from states
* never wait for promise to resolve (will hang up entire update queue
* see #1250 for discussion
* Fixing pytest version to 4.2.0
Pytest 4.2.1 has a weird bug on top level collect in 4.2.1 Fixing version to 4.2.0
* Make dispatcher use one context per update
It gives user the option to `overload` context with their own properties in a lower group handler if they like
* Improve callbackcontext & run_async docstring
- Add note about how you can add custom attributes to context.
- Add warnings about how run_async and custom attributes should not be used together.
* Small documentation improvements. [ci skip]
* update_filter attribute on filters
Makes it possible to have filters work on an update instead of message, while keeping behavior for current filters
* add update_type filter
* Messagehandler rework
- remove allow_edited (deprecated for a while)
- set deprecated defaults to None
- Raise deprecation warning when they're used
- add sensible defaults for filters.
- rework tests
* Commandhandler rework
* Remove deprecation test from new handler
* Some tweaks per CR
- rename update_types -> updates
- added some clarification to docstrings
* run webhook set test only on 3.6 on appveyor
* update_filter attribute on filters
Makes it possible to have filters work on an update instead of message, while keeping behavior for current filters
* add update_type filter
* Messagehandler rework
- remove allow_edited (deprecated for a while)
- set deprecated defaults to None
- Raise deprecation warning when they're used
- add sensible defaults for filters.
- rework tests
* Commandhandler rework
* Remove deprecation test from new handler
* Some tweaks per CR
- rename update_types -> updates
- added some clarification to docstrings
* run webhook set test only on 3.6 on appveyor
* Changes per CR
* Update travis to build v12
* small doc update
* try to make ci build version branches
* doc for BaseFilter
* Modify regexfilter and mergedfilter
Now returns a list of match objects for every regexfilter
* Change callbackcontext (+ docs)
* integrate in CommandHandler and PrefixHandler
* integrate in MessageHandler
* cbqhandler, iqhandler and srhandler
* make regexhandler a shell over MessageHandler
And raise deprecationWarning on creation
* clean up code and add some comments
* Rework based on internal group feedback
- use data_filter instead of regex_filter on BaseFilter
- have these filters return a dict that is then updated onto CallbackContext instead of using a list is before
- Add a .match property on CallbackContext that returns .matches[0] or None
* Fix and add test for callbackcontext.match
* Lots of documentation fixes and improvements [ci skip]
* Remove message decorator to fix default timeouts.
* Make message wrapper method private.
* Make tests pass
* Fix callbackquery shortcuts
Closes#1180
* Fix callbackquery shortcut tests
* Fix merge
* Address CR
* Add missing default timeout=20 for some bot file uploads
* Fix wrong return value in convhandler
Probably stems from a combination of bad merge plus quickly merged hacktoberfest PR.
* 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
* Add convenience classmethods for InlineKeyboardMarkup (#1186)
* Switch to row and column methods
* Also add convenience classmethods for ReplyKeyboardMarkup
* Add some simple tests
* Add conflicting bot id to conflict error message.
* Add test and comment to conflict error
* Don't extract bot id in Conflict exception per PR comments
* update MAX_CAPTION_LENGTH
Telegram silently changed the max length for captions to 1024 chars.
* Update test_constants.py
* change docstrings to reflect new length
* remove message
* clear message and proper match
* handler for ConversationHandler.END (timeout one) #1136
* review fixes
* review fixes
* review fixes
* review fixes
* docs and tests
* fixing stuff
* Fix problem
* fix conftest
* now it should work
* Add ConversationTimeoutContext
As discussed in the developers group. Use a class as the jobs context over using a dict.
* less verbosity
* Update data.py to be compatible with example
for now, if you process personal_info with example code, then you got an error if there is no set option to get native fist and last name.
setting default value will allow to process personal_info without native name/surname transation
* fixing line length
i hope i understood right this. sorry for delay, just starting using github!
* 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
* Patch urllib3RequestField to make it *not* support RFC2231
* Add new required test data file
* Fix on py2
* Remove weird legacy code from inputfile
Not needed anymore, and also makes it not work... so that was not great
* Fix passport decryption failing at random times
Sometimes a decrypted secret was being treated as b64 and therefore got decoded even further. Fix by decoding b64 right before call to decrypt so we have better control of when not to do it
* Bot api 4.1
Telegram passport 1.1
Added support for middle names.
Added support for translations for documents
Add errors for translations for documents
Added support for requesting names in the language of the user's country of residence
Replaced the payload parameter with the new parameter nonce
NOTE: Scope stuff is NOT implemented, as we wanna STRONGLY encourage users to use the telegram provided SDKs anyway (and not generate telegram auth links in their bot, but rather on a server)
* Minor fixes
* Add hash to EncryptedPassportElement
For use with PassportElementErrorUnspecified apparently
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 :)
* Use python 3 on read the docs
This has multiple improvements on the inspection of classes. Mainly that method signatures propely display the arguments for the method.
* Add note to telegram.Bot about camelCase
Switching to py3 means that the camelCase method descriptors will no longer be displayed in the docs. Adding a note to Bot to clarify they exist.
* Add Alias links for all camelCase
* 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 in telegram.Message
The `_parse_(html|markdown)` methods now properly return `None` on an empty `Message.text` or an empty `Message.caption`
* As per CR
* 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.
* add documentation for telegram.utils.promise and .request
* improve documentation for telegram.utils.promise and .request
* add missing 's' to new_chat_member(s) in all docstrings
* fix docs for `set_chat_photo`
[CI skip]
- File.download_as_bytearray - new method to get a d/led file as bytearray
This is much more convenient and straight forward than using a file
object.
- File.download(): Now returns a meaningful return value
- File.download*(): New and/or better unitests
We have some objects that have exactly the same to_dict() method, only specifying that `from_user` should be `from` in the `data`-dict. I refractored this logic to `TelegramObject` and removed those to_dicts() from the code.