- Notifications
You must be signed in to change notification settings - Fork5.7k
v13#1982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
v13#1982
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2a9a5b0
to1fdc197
Compareb3e9be1
tob7e635b
CompareAPI Keyword ArgumentsPre-v12 the Bot methods accepted arbitrarty keyword argument via the bot.send_message(...,custom_kwarg=42) need to be changed to bot.send_message(...,api_kwargs={'custom_kwarg':42}) As PTB is currently up to date wtih the Telegram API, this shouldn't affect your code in the most cases. If it does, it means that you had a typo somewhere. |
Bibo-Joshi commentedJul 13, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
JobQueue RefactoredPreviously, PTB implemented the scheduling of tasks in the But what does this mean for you in detail? If you're scheduling tasts vanilla style as e.g. context.job_queue.run_once(callback,when) you will only have to change the handling of timezones, or even nothing at all. In fact, everything covered in thiswiki article will work unchanged expect for timezones. So before bothering to read on, just try to run you bot - it most cases it will still work. However, there are some more advanced things, that changed. Handling of timezonesThe Changes in advanced schedulingLeveraging the APScheduler library brings both some perks in terms of new features as well as some breaking changes. Please keep in mind:
That said, here are the perks and changes: New features
ChangesMost importantly, the There are some other minor changes, most of which will most likely not affect you. For details, please see the documentation of Setting up a |
Update wiki:
Storing BotsAs of v13, persistence will try to replace Persistence of BotsStoring
In most cases, this won't directly affect you. Note however, that changing the used bot token may lead to e.g. *Okay, almost all, For the limitations, see |
Rich Comparisonv13 adds rich comparison to more Telegram objects. This means that e.g. Special note on |
1e29c1a
to7867b9b
CompareDeprecation of |
Bibo-Joshi commentedJul 28, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Update WikiThispart on custom filters must be updated. Refactoring of FiltersIn order to reduce confusion over the arguments of the
both inheriting from If you have custom filters inheriting from |
dcf7328
toad30a8f
CompareDeprecation of old handler APIThe context-based API introduced in v12 is now the default, i.e. the |
Dropping support for Python 3.5As Python 3.5 reaches/reached its end of life on ~2020-09-13, v13 drops support for Python 3.5. More precisely, some Python 3.6+-only features are introduced, making PTB incompitable with Python 3.5 as of v13. |
be9e5d1
to3993250
CompareDefaults.tzinfoUpdate example in wiki: importpytzimportdatetimeasdtmfromtelegramimportParseModefromtelegram.extimportUpdater,MessageHandler,Filters,Defaultsdefjob(context):chat_id=context.job.contextlocal_now=dtm.datetime.now(context.bot.defaults.tzinfo)utc_now=dtm.datetime.utcnow()text='Running job at {} in timezone {}, which equals {} UTC.'.format(local_now,context.bot.defaults.tzinfo,utc_now )context.bot.send_message(chat_id=chat_id,text=text)defecho(update,context):# Send with default parse modeupdate.message.reply_text('<b>{}</b>'.format(update.message.text))# Override default parse mode locallyupdate.message.reply_text('*{}*'.format(update.message.text),parse_mode=ParseMode.MARKDOWN)update.message.reply_text('*{}*'.format(update.message.text),parse_mode=None)# Schedule jobcontext.job_queue.run_once(job,dtm.datetime.now()+dtm.timedelta(seconds=1),context=update.effective_chat.id)defmain():"""Instantiate a Defaults object"""defaults=Defaults(parse_mode=ParseMode.HTML,tzinfo=pytz.timezone('Europe/Berlin'))"""Start the bot."""updater=Updater("TOKEN",use_context=True,defaults=defaults)# Get the dispatcher to register handlersdp=updater.dispatcher# on non command text message - echo the message on Telegramdp.add_handler(MessageHandler(Filters.text&~Filters.command,echo))# Start the Botupdater.start_polling()updater.idle()if__name__=='__main__':main() |
3247477
tob7293a4
Compare
Deprecation of |
9252b0f
tobce39cc
Comparepytest fail is unrelated and codecov was expected. ready for merge 🕺 |
* Unify kwargs handling in Bot methods* Remove Request.get, make api_kwargs an explicit argument, move note to head of Bot class* Fix test_official* Update get_file methods
* First go on refactoring JobQueue* Temporarily enable tests for the v13 branch* Work on tests* Temporarily enable tests for the v13 branch* Increase coverage* Remove JobQueue.tick()* Address review* Temporarily enable tests for the v13 branch* Address review* Dispatch errors* Fix handling of job_kwargs* Remove possibility to pass a Bot to JobQueue
* Refactor persistence of bots* Use BP.set_bot in Dispatcher* Add documentation
* Make most objects comparable* ID attrs for PollAnswer* fix test_game* fix test_userprofilephotos* update for API 4.7* Warn on meaningless comparisons* Update for API 4.8* Address review* Get started on docs, update Message._id_attrs* Change PollOption & InputLocation* Some more changes* Even more changes
* Refactor handling of `default_quote`* Make it a breaking change* Pickle a bots defaults* Temporarily enable tests for the v13 branch* Temporarily enable tests for the v13 branch* Refactor handling of kwargs in Bot methods (#1924)* Unify kwargs handling in Bot methods* Remove Request.get, make api_kwargs an explicit argument, move note to head of Bot class* Fix test_official* Update get_file methods* Refactor JobQueue (#1981)* First go on refactoring JobQueue* Temporarily enable tests for the v13 branch* Work on tests* Temporarily enable tests for the v13 branch* Increase coverage* Remove JobQueue.tick()* Address review* Temporarily enable tests for the v13 branch* Address review* Dispatch errors* Fix handling of job_kwargs* Remove possibility to pass a Bot to JobQueue* Refactor persistence of Bot instances (#1994)* Refactor persistence of bots* User BP.set_bot in Dispatcher* Temporarily enable tests for the v13 branch* Add documentation* Add warning to Updater for passing both defaults and bot* Address review* Fix test
* Refactor handling of message vs update filters* address review
Uh oh!
There was an error while loading.Please reload this page.
For the moment I'm just here so that PRs to v13 can be properly checked by Codacy and Codecov.
When v13 is ready, I can be merged. For now, comment here to gather info for the coming v13 transition guide.
The PRs merged into v13: