Commit graph

405 commits

Author SHA1 Message Date
GauthamramRavichandran
5da1dd7ce9
Add max_connections Parameter to Updater.start_webhook (#2547)
* Include max_connections args

* Update docs & add test

Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-06-06 09:27:45 +02:00
Stɑrry Shivɑm
46cdeb495a
Fix for Promise.done_callback (#2544)
* Don't call done_cb on exceptions

Signed-off-by: starry69 <starry369126@outlook.com>

* improve docs

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* revert black

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
2021-06-05 17:08:45 +02:00
Harshil
92ff6a8e2b
Add __slots__ (#2345)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-05-29 16:18:16 +02:00
Bibo-Joshi
8bf88c3231
Supplement Codacy with DeepSource (#2454)
* Add deepsource config

* Update Badges

* Update Badges some more

* Stupid change to trigger analysis of all files

* Try to get ignore right

* Update badges again

* Get started on fixing issues

* Fix some more issues

* Remove more plank lines

* Docs for de_json/list & to_dict/json

* Some improvements from deepcode.ai

* Some more improvements

* Some more improvements

* More docstrnigs & let's run DS on the tests just for fun

* Autofix issues in 10 files

Resolved issues in the following files via DeepSource Autofix:
1. tests/conftest.py
2. tests/test_bot.py
3. tests/test_commandhandler.py
4. tests/test_conversationhandler.py
5. tests/test_dispatcher.py
6. tests/test_filters.py
7. tests/test_inputmedia.py
8. tests/test_messagehandler.py
9. tests/test_official.py
10. tests/test_persistence.py

* Some more improvements for tests, but that shall be enough

* Some more docstrings for functions

* Some minor stuff, try to fix tests

* Update DS config

* Still more docs

* Doc fixes

* More fixes

* Fix: indent docstring

* Some fixes

* Revert "Stupid change to trigger analysis of all files"

This reverts commit dd46c260

* Review

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
2021-05-27 09:38:17 +02:00
Poolitzer
1572c61063
Increase Test Coverage of CallbackQueryHandler (#2520)
* Test: let's see

* Test: let's see, now in the correct place

* Fix: Explicitly return None in else clause

also documented this behaviour clearly in the docstring

* add link in doc

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* Fix: remove unnecessary else statement

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
2021-05-27 09:37:37 +02:00
Poolitzer
cd69f69b28
Add Filters.attachment (#2528)
* feat: attachment filter

* fix: add versionadded statement

* Fix: small doc string changes

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
2021-05-19 10:39:10 +02:00
Poolitzer
8b0d2e5f75
Add pattern Argument to ChosenInlineResultHandler (#2517)
* Feat: add pattern arg to ChosenInlineResultHandler

* Fix: remove unnecessary if clause

the attribute must be present, since it's not optional.

* Fix: wrong type documentation

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* Fix: Addressing code review

small documentation fixes, and moving one test.

* Fix: link to matches

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* Fix: also link here

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
2021-05-19 10:32:11 +02:00
Bibo-Joshi
08ba7c7793
Handle Classes as Input for BasePersistence.replace/insert_bot (#2523)
* Ignore classes on replace/insert_bot

* Review
2021-05-16 20:02:35 +02:00
Bibo-Joshi
9737b1d3c7
Bump Tornado Version and Remove Workaround from #2067 (#2494) 2021-05-05 20:59:06 +02:00
Bibo-Joshi
bae57c7f8f
Doc Fixes (#2437)
Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Harshil <ilovebhagwan@gmail.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
2021-04-30 10:47:41 +02:00
Bibo-Joshi
4645d0e32a
Improve Type Hints of Data Filters (#2456) 2021-04-30 10:12:18 +02:00
Stɑrry Shivɑm
7e554584b1
Improve Timeouts in ConversationHandler (#2417)
* Handle promise states in conversation timeout

Signed-off-by: starry69 <starry369126@outlook.com>

* warn if nested conversation & timeout

Signed-off-by: starry69 <starry369126@outlook.com>

* Add notes and test for conversation_timeout

Signed-off-by: starry69 <starry369126@outlook.com>

* Try to fix pre-commit

Signed-off-by: starry69 <starry369126@outlook.com>

* Test promise exception

Signed-off-by: starry69 <starry369126@outlook.com>

* Welp

Signed-off-by: starry69 <starry369126@outlook.com>

* improve docs

Signed-off-by: starry69 <starry369126@outlook.com>

* typo

Signed-off-by: starry69 <starry369126@outlook.com>

* try to fix codecov

Signed-off-by: starry69 <starry369126@outlook.com>

* refactor timeout logic with promise.add_done_cb

Signed-off-by: starry69 <starry369126@outlook.com>

* small fix

Signed-off-by: starry69 <starry369126@outlook.com>

* Address review

Signed-off-by: starry69 <starry369126@outlook.com>

* Fix some type hinting

* Few fixes

Signed-off-by: starry69 <starry369126@outlook.com>

* fix tests

Signed-off-by: starry69 <starry369126@outlook.com>

* minor nitpick

Signed-off-by: starry69 <starry369126@outlook.com>

Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-04-30 10:10:46 +02:00
Bibo-Joshi
b6a6d7f872
Api 5.2 (#2489)
* Bump API Version to v5.2

* InputInvoiceMessageContent & simplify *Markup.__eq__ on the fly

* Updates to send_invoice

* InlineQuery updatees and new parameter for InlineQueryhandler

* VCScheduled - not integrated into Message yet

* Bump requirements-dev.txt versions

* Message.voice_chat_scheduled & new Filters.status_update.vcs

* Some doc updates

* Review

* All praise harshil, the god of finding typos :)

* Review

* More warnings
2021-04-30 10:09:21 +02:00
Stɑrry Shivɑm
b63877b1f2
Add Two UserWarnings (#2464)
* Warn if number of workers < one

Signed-off-by: starry69 <starry369126@outlook.com>

* improve warning message

Signed-off-by: starry69 <starry369126@outlook.com>

* warn if converstation handler return unknown state

Signed-off-by: starry69 <starry369126@outlook.com>

* Show handler name and state aswell, in warning

Signed-off-by: starry69 <starry369126@outlook.com>

* minor nitpick

Signed-off-by: starry69 <starry369126@outlook.com>
2021-04-16 19:02:43 +02:00
Aksh Gupta
9d93417d9a
Improve Code Quality (#2450)
* chore: refactor code quality issues

* Add comment for removing assert statements

* Remove deepsource config file

* Fix Coverage

Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-04-05 13:25:27 +02:00
Harshil
9e08fa30b6
Filters.forwarded_from (#2446)
* new filter and more tests!

* document forward filter better, fix a test.

* Minor formulation nitpicking

Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-03-28 11:50:45 +02:00
Bibo-Joshi
7d893fd04b
Doc Fixes (#2404)
* Improve some badges for PTB-Raw

* doc fix for add_error_handler

* Some rendering

* Bump sphinx dependency

* Change signature annotation setting

* fix: chat_id can be string, message_id only int

* feat: add RTD link to documentation

* improving sender chat docstring (#2412)

* fix: improving sender chat docstring

also adding a note to a weird edge case

* fix: words being hard

* Add note on donations

* typo

* typo in User.get_profile_pictures docstrings

* Fix: meth, not attr for meth, not attr

* filters + inlinequery doc fix

* Bump versions, update RTD config file

* Try fix build

* Revert "fix: chat_id can be string, message_id only int"

This reverts commit ba04e5aa

* Add Starry & Harshil to credits

Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Harshil <ilovebhagwan@gmail.com>
2021-03-14 16:46:37 +01:00
Poolitzer
ac02bce109
API 5.1 (#2424)
* Feat: New invite links

* Fix: doc strings

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* new dice, new admin privilege, revoke_messages, update and fix some docs

* add missing param to shortcut

* Add ChatMemberUpdated

* Add voicechat related objects

Signed-off-by: starry69 <starry369126@outlook.com>

* add versionadd tags

Signed-off-by: starry69 <starry369126@outlook.com>

* Fix filter tests

* Update tg.Update

* ChatMemberHandler

* Add versioning directives

* add can_manage_voice_chats attr and fix docs

Signed-off-by: starry69 <starry369126@outlook.com>

* fix chat shortcut

Signed-off-by: starry69 <starry369126@outlook.com>

* address review

* MADTC

* Chat.message_auto_delete_time

* Some doc fixes

* address review

Signed-off-by: starry69 <starry369126@outlook.com>

* welp

Signed-off-by: starry69 <starry369126@outlook.com>

* Add voicechat related filters

Signed-off-by: starry69 <starry369126@outlook.com>

* Fix: Addressing review

change place of version adding, added obj:True as doc string, changing how member limit is initiated

* feat: adding chat shortcuts for invite links

* fix: changing equality of chatinviteobjects

* Non-test comments

* Some test fixes

* A bit more tests

* Bump API version in both readmes

* Increase coverage

* Add Bot API Version in telegram.constants (#2429)

* add bot api version in constants

Signed-off-by: starry69 <starry369126@outlook.com>

* addressing review

Signed-off-by: starry69 <starry369126@outlook.com>

* add versioning directive

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>

* pre-commit & coverage

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
Co-authored-by: Harshil <ilovebhagwan@gmail.com>
Co-authored-by: starry69 <starry369126@outlook.com>
2021-03-14 16:41:35 +01:00
Bibo-Joshi
3a9a0ab96d
Update pre-commit Settings (#2415)
Co-authored-by: Harshil <ilovebhagwan@gmail.com>
2021-03-13 16:21:03 +01:00
Bibo-Joshi
aba17cb997
Improve Updater.set_webhook (#2419)
* Get started

* tests

* Some doc fixes

* Some doc fixes
2021-03-13 15:35:26 +01:00
Bibo-Joshi
552298595c
Doc Fixes (#2359)
* Improve some badges for PTB-Raw

* doc fix for add_error_handler

* Some rendering

* Doc fixes for filters.py

* render '@' as code

Co-authored-by: Harshil <ilovebhagwan@gmail.com>
2021-02-19 19:27:17 +01:00
Bibo-Joshi
2a4a0d0ccd
Refactor Defaults Integration (#2363)
* Change default handling, update signatures, get existing tests to pass.

* Try running tests on ubuntu 18.04

* Roll back

* Rework check_shortcut_call tests

* Further improve check_shortcut_call tests

* Start on defaults-checks for shortcuts, get it working for test_message

* Add check_shortcut_defaults to all other shortcut tests

* Some fine tuning

* Add defaults checking for bot methods

* Missing tests for TestCallbackQuery

* Test edit_message_media with defaults & some comments

* Fix cryptography requirement

* drop debug prints

* Remove debug prints

* Another try

* Try to fix coverage & logs

* Rearrange test order

* increase coverage

* Try to fix coverage reports

* address review

* Adapt tests like in #2386

* fix CI

* fix CI
2021-02-19 19:07:48 +01:00
Bibo-Joshi
c77ef7eef3
Deprecate MessageQueue (#2393) 2021-02-19 17:29:50 +01:00
Hinrich Mahler
1902c0ac36 Bump version to v13.2 2021-02-02 20:57:14 +01:00
Bibo-Joshi
544a3fbf48
ConversationHandler: Docs & edited_channel_post behavior (#2339)
* Update docs & ignore edited channel posts

* typo

* Apply suggestions from code review

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>

* Update telegram/ext/conversationhandler.py

* fix pre-commit

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
2021-02-01 19:26:03 +01:00
Bibo-Joshi
36d49ea9cd
Doc Fixes (#2253)
* Render-fixes for BP

* docs: fix simple typo, submition -> submission (#2260)

There is a small typo in tests/test_bot.py.

Should read `submission` rather than `submition`.

* Type on rawapibot.py docstring

* typo

* Typo: Filters.document(s)

* Typo fix

* Doc fix for messageentity (#2311)

* Add New Shortcuts to Chat (#2291)

* Add shortcuts

* Add a note

* Add run_async Parameter to ConversationHandler (#2292)

* Add run_async parameter

* Update docstring

* Update test to explicitly specify parameter

* Fix test job queue

* Add version added tag to docs

* Update docstring

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>

* Doc nitpicking

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>

* Fix rendering in messageentity

Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
Co-authored-by: zeshuaro <joshuaystang@gmail.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>

* fix: type hints for TelegramError

changed :class:`telegram.TelegramError` to :class:`telegram.error.TelegramError`

* fix: the error can be more then just a Telegram error

* Doc fix for inlinekeyboardbutton.py

added missing colon which broke rendering

* fix: remove context argument and doc remark

look at us already being in post 12

* use rtd badge

* filters doc fixes

* fix some rendering

* Doc & Rendering fixes for helpers.py

Co-authored-by: Tim Gates <tim.gates@iress.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
Co-authored-by: zeshuaro <joshuaystang@gmail.com>
Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Harshil <ilovebhagwan@gmail.com>
2021-02-01 17:59:39 +01:00
Bibo-Joshi
25506f131d
python-telegram-bot-raw (#2324)
* POC

* Remove decorator dependency

* Rework setup.py & build, add separate readme

* Move utils -> ext.utils

* Move pytz dep to ext

* Try fixing timing stuff

* Add 'Typed' classifier

* Update README_RAW.rst

Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>

* Some wording

* Deprecation warnings for moved tg.utils

* Tests for Promise

* Test time-helpers without pytz

* Try fixing time-helper tests

* Merge master

Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
2021-01-30 14:15:39 +01:00
Bibo-Joshi
70aba136e4
Reduce Usage of typing.Any (#2321)
* Use object instead of Any where possible

* Revert a lof of noise from the PR
2021-01-30 11:38:54 +01:00
Bibo-Joshi
f31787a8ef
Add pyupgrade to pre-commit Hooks (#2301)
* Add pyupgrade to pre-commit

* update test_chat
2021-01-17 23:24:20 +01:00
zeshuaro
0c9915243d
Add run_async Parameter to ConversationHandler (#2292)
* Add run_async parameter

* Update docstring

* Update test to explicitly specify parameter

* Fix test job queue

* Add version added tag to docs

* Update docstring

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>

* Doc nitpicking

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
2021-01-09 20:05:58 +01:00
Bibo-Joshi
ffd675daec
Adjust Calling of Dispatcher.update_persistence (#2285)
* Adjust calling of update_persistence

(cherry picked from commit 89c522d883)

* Fix tests and stuff
2021-01-07 21:31:00 +01:00
Bibo-Joshi
6903d58142
Update Copyright (#2289)
* Update coypright headers

* typos
2021-01-04 17:24:14 +01:00
starry69
91e0271e4c Update copyright headers
Signed-off-by: starry69 <starry369126@outlook.com>
2021-01-03 10:40:24 +05:30
Hinrich Mahler
9ddb361f76 Revert "Adjust calling of update_persistence"
This reverts commit 89c522d883.
2021-01-01 21:44:23 +01:00
Hinrich Mahler
89c522d883 Adjust calling of update_persistence 2021-01-01 21:40:42 +01:00
Bibo-Joshi
2effff8254
Change Order of Class DocStrings (#2256) 2020-12-30 15:59:50 +01:00
Bibo-Joshi
ef703d19e9
Doc Fixes (#2225)
* Fix dscr for soccer ball values

* Update docs of BasePersistence regarding abc

* elaborate run_daily docs

* Make docstring of send_document.filename more precise

* increase bot API and add Discussion link

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
2020-12-17 09:29:17 +01:00
Bibo-Joshi
77a8c64f6c
Improve Annotations & Docs of Handlers (#2243)
* Improve typing & docs of handlers

* Apply suggestions from code review

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>

Co-authored-by: Poolitzer <25934244+Poolitzer@users.noreply.github.com>
2020-12-16 17:34:57 +01:00
Bibo-Joshi
ca04daf782
Doc Fixes & Extensions (#2201)
* Add note on dispatcherhandlerstop to conversationhandler

* Fine tune @run_async deprecation warning

* Refine docs of JobQueue.jobs/get_jobs_by_name
2020-11-29 16:25:47 +01:00
Bibo-Joshi
ae9ce60b55
API 5.0 (#2181)
Co-authored-by: poolitzer <25934244+Poolitzer@users.noreply.github.com>
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
2020-11-29 16:20:46 +01:00
Bibo-Joshi
58b9882021
Use F-Strings Where Possible (#2222) 2020-11-23 22:09:29 +01:00
Bibo-Joshi
df6d5f0840
Fix bugs in replace/insert_bot (#2218)
* Fix bugs in replace/insert_bot

* Some tweaks
2020-11-22 11:08:46 +01:00
Stɑrry Shivɑm
425716f966
Add Defaults.run_async (#2210)
* Add Defaults.run_async support

Signed-off-by: starry69 <starry369126@outlook.com>

* Address some requested changes.

Signed-off-by: starry69 <starry369126@outlook.com>

* Add tests for defaults.run_async

Signed-off-by: starry69 <starry369126@outlook.com>

* Fix tests logic & add default value support for dp.add_error_handler

Signed-off-by: starry69 <starry369126@outlook.com>

* Fix tests, with requested changes

Signed-off-by: starry69 <starry369126@outlook.com>

* Add tests for error_handler

Signed-off-by: starry69 <starry369126@outlook.com>

* try to fix pre-commit

Signed-off-by: starry69 <starry369126@outlook.com>

* Enhance tests & address suggested changes

Signed-off-by: starry69 <starry369126@outlook.com>

* Improve docs

Signed-off-by: starry69 <starry369126@outlook.com>
2020-11-17 21:31:01 +01:00
Bibo-Joshi
8d9bb26cca
Improve Handling of Custom Objects in BasePersistence.insert/replace_bot (#2151)
* Handle unpickable objects

* Improve coverage

* Add user warning

* make comparison to REPLACED_BOT safe

* make pre-commit happy

* Shorten warning
2020-11-14 03:08:18 +01:00
Bibo-Joshi
d1438a9b23
Add XOR Filters and make Filters.name a Property (#2179)
* XOR Filters and make Filters.name a property

* add XORFilter to __all__

* Change example
2020-11-07 08:44:45 +01:00
Evgeny Denisov
27b03edc59
Expand Type Hints to Tuples (#2167)
Co-authored-by: Pranjalya <pranjalyawarrior@gmail.com>
2020-11-07 08:26:32 +01:00
Evgeny Denisov
ac449deb5d
Add Filters.document.file_extension (#2169)
Co-authored-by: Matheus Lemos <matheuslemosf@protonmail.com>
Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
2020-11-06 18:41:54 +01:00
Bibo-Joshi
3b9187ed5a
Rename kwargs to _kwargs where possible (#2182) 2020-11-05 18:12:01 +01:00
Marco Fincato
a0cd6e8fef
Add Filters.caption_regex (#2163)
* Check caption in Filters.regex

Added regex matching for message caption in Filters.regex.

* Moved caption check to Filters.caption_regex

* Added caption_regex tests

The same as for regex, with only the content of the message changed, that is now inside caption.

* Fixed pre-commit tests

Lines too long and an additional blank line

* Moved line break to comply

* Reformatted code with black

* Added docstrings
2020-11-04 20:54:24 +01:00
Bibo-Joshi
92b9370c23
Improve Code Quality (#2131)
* Make pre-commit more strict

* Get pylint to read setup.cfg

* Make pylint & mypy happy aka ignore all the things

* use LogRecord.getMessage() in tests

* Make noam happy

* Update both pylint & mypy while we're at it

* Bring reqs-dev and makefile up to speed

* try making pre-commit happy

* fix jobqueue tests on the fly
2020-10-31 16:33:34 +01:00