* pollbot.py example was sending the poll to the effective_user and not effective_chat... well, it's a poll to be answered by multiple uses.
* Use User.mention_html() shortcut
Co-authored-by: Leonardo <leonardo.rezende@trt19.jus.br>
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* feat: via_bot filter
also fixing a small mistake in the empty parameter of the user filter and improve docs slightly
* fix: forgot to set via_bot to None
* fix: redoing subclassing to copy paste solution
* Cosmetic changes
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* added test for 'clean' argument passed to 'start_polling()'
* remove TODO
* prettify
* remove bool from func name
* improve name-ing of fake update func
* cleanup class and nameing
* replace while for for
* swap valueerror for runtimeerror
* remove all other code to reduce testing
* add comments
* don't raise error, complete cycle and assert
* remove inf loop protection
* Revert "remove all other code to reduce testing"
This reverts commit 4566a1debd.
* remove error parametrization
* remove comment
* remove pass from class
* rename update_id to offset as the original get_updates() takes argument offset (which is the update_id)
* rename test func to match original func
* fix comment
* shorten for loop
* mock get_updates() behavior when 'offset' is passed. Assert with get_updates()
* remove other functions to reduce testing
* replicate original get_updates()
* move fakeupdate class and list creation outside get_updates and store in var
* loop from 0 to make update_id consistant w array key, just easier to debug
* update comments
* Revert "remove other functions to reduce testing"
This reverts commit 1fb498a6cc.
* fix typo
* Revert "fix typo"
This reverts commit ade9fec609.
* Revert "Revert "remove other functions to reduce testing""
This reverts commit 734de1371c.
* Revert "update comments"
This reverts commit f3a032e75e.
* Revert "loop from 0 to make update_id consistant w array key, just easier to debug"
This reverts commit 0c6881d8a1.
* Revert "move fakeupdate class and list creation outside get_updates and store in var"
This reverts commit 71de999300.
* Revert "replicate original get_updates()"
This reverts commit 5d0710ac3a.
* Revert "remove other functions to reduce testing"
This reverts commit 1fb498a6cc.
* Revert "mock get_updates() behavior when 'offset' is passed. Assert with get_updates()"
This reverts commit 8c727ba1e8.
* loop from 0 to make update_id consistant w array key, for consitency
Co-authored-by: ikkemaniac <ikkemaniac@localhost>
* Remove error handlers from examples
Most examples use the same error handler, that error handler logs
update.to_dict but doesn't log error traceback. Hiding error traceback
is quite bad, removing the error handler entirely causes PTB to use
default error logging which does include error traceback.
* adding error handling example
* Change error handler example
Including:
- Change the telegram message to include usual python error message.
- HTML-escape the strings used to build the telegram message.
- Capitalize comments and add more empty lines to hopefully unify the
style with other examples, at least a bit.
- Reorder imports.
* Add an error-rising command to the error handler example
* Slightly change example error handler docstring and comments
* Make telegram message sent by the error handler example more readable
* Rename error_handler.py to errorhandlerbot.py and add a start command
* Change error handler example to work without developer chat id
* Revert "Change error handler example to work without developer chat id"
This reverts commit c4efea6f
* Make bot token a module level constant in the error handler example
Otherwise the example will require two edits 40 lines apart to run.
* Show chat id in start command of the error handler example
The example requires you to set developer chat id, this change will
make things easier for users that don't know how to see their chat id.
* Add errorhandlerbot.py to the examples folder readme
Co-authored-by: poolitzer <25934244+poolitzer@users.noreply.github.com>
Co-authored-by: Bibo-Joshi <hinrich.mahler@freenet.de>
* Update notes on editing messages
* Update thumb and InputMedia* doc strings
* Fix attribute docstring for Updater.user_sig_handler
* Improve rendering for CCs attributes
* fix doc str for InputMedia*.media attribute
* Minor fix
* Make Filters.user attrs mutable
* Add test_filters_user_empty_args
* Add test_filters_user_empty_args
* fix locks
* Make codecov happy
* Make user_ids and usernames sets
* Correct doc string
* Address review
* Review Vol. II
* Apply suggestions from code review
Co-authored-by: Noam Meltzer <tsnoam@gmail.com>
* Review Vol III.
* propery setter is now only a wrapper to a private method + more cleanups
pylint complained on some extra stuff, so cleaned them as well
* Review Vol. IV
* Review Vol. V
* Apply changes to Filters.chat
Co-authored-by: Noam Meltzer <tsnoam@gmail.com>
* next_t property is added to Job class
Added new property to Job class - next_t, it will show the datetime when the job will be executed next time.
The property is updated during JobQueue._put method, right after job is added to queue.
Related to #1676
* Fixed newline and trailing whitespace
* Fixed PR issues, added test
1. Added setter for next_t - now JobQueue doesn't access protected Job._next_t.
2. Fixed Job class docstring.
3. Added test for next_t property.
4. Set next_t to None for run_once jobs that already ran.
* Fixed Flake8 issues
* Added next_t setter for datetime, added test
1. next_t setter now can accept datetime type.
2. added test for setting datetime to next_t and added some asserts that check tests results.
3. Also noticed Job.days setter raises ValueError when it's more appropriate to raise TypeError.
* Fixed test_warnings, added Number type to next_t setter
1. Changed type of error raised by interval setter from ValueError to TypeError..
2. Fixed test_warning after changing type of errors in Job.days and Job.interval.
3. Added Number type to next_t setter - now it can accept int too.
* Python 2 compatibility for test_job_next_t_property
Added _UTC and _UtcOffsetTimezone for python 2 compatibility
* Fixed PR issues
1. Replaced "datetime.replace tzinfo" with "datetime.astimezone"
2. Moved testing next_t setter to separate test.
3. Changed test_job_next_t_setter so it now uses non UTC timezone.
* Defining tzinfo from run_once, run_repeating
1. Added option to define Job.tzinfo from run_once (by when.tzinfo) and run_repeating (first.tzinfo)
2. Added test to check that tzinfo is always passed correctly.
* address review
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* Bot.py doc fixes
All docs obtained from official Bot API docs
* made flake8 happy
* address review
Also improved consistency of `returns:` in docs
Co-authored-by: Hinrich Mahler <hinrich.mahler@freenet.de>
* Pure API changes
* Address review
* set Bot.commands on successfull call of set_my_commands
* Get started on tests
* More tests!
* More Coverage!
* Reset changes in utils.request
* Filters.dice, Filters.dice.text
* more coverage
* Address review
* Address review
* Test stop_poll with reply_markup
* Test stop_poll also without reply_markup
* Rephrase note on 'dice'
* Fix grammar in note on Filters.dice
* update api version readme
* address review