Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Full Support for Bot API 8.0#4566

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

Merged
Bibo-Joshi merged 10 commits intomasterfromapi-8.0
Dec 1, 2024
Merged

Full Support for Bot API 8.0#4566

Bibo-Joshi merged 10 commits intomasterfromapi-8.0
Dec 1, 2024

Conversation

Bibo-Joshi
Copy link
Member

@Bibo-JoshiBibo-Joshi commentedNov 17, 2024
edited
Loading

Master PR for all API 8.0 changes.
Closes#4567 when ready

If the PR contains API changes (otherwise, you can ignore this passage)

  • Checked the Bot API specific sections of theStability Policy

  • Created a PR to remove functionality deprecated in the previous Bot API release (see here)

  • New classes:

    • Addedself._id_attrs and corresponding documentation
    • __init__ acceptsapi_kwargs as kw-only
  • Added new shortcuts:

    • Intelegram.Chat &telegram.User for all methods that acceptchat/user_id
    • Intelegram.Message for all methods that acceptchat_id andmessage_id
    • For newtelegram.Message shortcuts: Addedquote argument if methods acceptsreply_to_message_id
    • Intelegram.CallbackQuery for all methods that accept eitherchat_id andmessage_id orinline_message_id
  • If relevant:

    • Added new constants attelegram.constants and shortcuts to them as class variables

    • Link new and existing constants in docstrings instead of hard-coded numbers and strings

    • Add new message types totelegram.Message.effective_attachment

    • Added new handlers for new update types

      • Add the handlers to the warning loop in thetelegram.ext.ConversationHandler
    • Added new filters for new message (sub)types

    • Added or updated documentation for the changed class(es) and/or method(s)

    • Added the new method(s) to_extbot.py

    • Added or updatedbot_methods.rst

    • Updated the Bot API version number in all places:README.rst (including the badge) andtelegram.constants.BOT_API_VERSION_INFO

    • Added logic for arbitrary callback data intelegram.ext.ExtBot for new methods that either accept areply_markup in some form or have a return type that is/containstelegram.Message

@Bibo-JoshiBibo-Joshi added ⚙️ bot-apiaffected functionality: bot-api 🔌 enhancementpr description: enhancement labelsNov 17, 2024
@codecovCodecov
Copy link

codecovbot commentedNov 28, 2024
edited
Loading

❌ 1 Tests Failed:

Tests completedFailedPassedSkipped
613516134224
View the top 1 failed tests by shortest run time
tests.ext.test_application.TestApplication::test_stop_running[polling]
Stack Traces | 0.522s run time
self=<tests.ext.test_application.TestApplicationobjectat0x7fd8a93a18b0>one_time_bot=PytestExtBot[token=696188732:AAGVwEKfHHlNjscxEDNKAwkhGstZ_ko1mC0]monkeypatch=<_pytest.monkeypatch.MonkeyPatchobjectat0x7fd8a4d57310>method='polling'@pytest.mark.parametrize("method", ["polling","webhook"])deftest_stop_running(self,one_time_bot,monkeypatch,method):# asyncio.Event() seems to be hard to use across different threads (awaiting in main# thread, setting in another thread), so we use threading.Event() instead.# This requires the use of run_in_executor, but that's fine.put_update_event=threading.Event()callback_done_event=threading.Event()called_stop_running=threading.Event()assertions= {}asyncdefpost_init(app):# Simply calling app.update_queue.put_nowait(method) in the thread_target doesn't work# for some reason (probably threading magic), so we use an event from the thread_target# to put the update into the queue in the main thread.asyncdeftask(app):awaitasyncio.get_running_loop().run_in_executor(None,put_update_event.wait)awaitapp.update_queue.put(method)app.create_task(task(app))app= (ApplicationBuilder()            .application_class(PytestApplication)            .updater(PytestUpdater(one_time_bot,asyncio.Queue()))            .post_init(post_init)            .build()        )monkeypatch.setattr(app.bot,"get_updates",empty_get_updates)events= []monkeypatch.setattr(app.updater,"stop",call_after(app.updater.stop,lambda_:events.append("updater.stop")),        )monkeypatch.setattr(app,"stop",call_after(app.stop,lambda_:events.append("app.stop")),        )monkeypatch.setattr(app,"shutdown",call_after(app.shutdown,lambda_:events.append("app.shutdown")),        )monkeypatch.setattr(app.bot,"set_webhook",return_true)monkeypatch.setattr(app.bot,"delete_webhook",return_true)defthread_target():waited=0whilenotapp.running:time.sleep(0.05)waited+=0.05ifwaited>5:pytest.fail("App apparently won't start")time.sleep(0.1)assertions["called_stop_running_not_set"]=notcalled_stop_running.is_set()put_update_event.set()time.sleep(0.1)assertions["called_stop_running_set"]=called_stop_running.is_set()# App should have entered `stop` now but not finished it yet because the callback# is still runningassertions["updater.stop_event"]=events== ["updater.stop"]assertions["app.running_False"]=notapp.runningcallback_done_event.set()time.sleep(0.1)# Now that the update is fully handled, we expect the full shutdownassertions["events"]=events== ["updater.stop","app.stop","app.shutdown"]asyncdefcallback(update,context):context.application.stop_running()called_stop_running.set()awaitasyncio.get_running_loop().run_in_executor(None,callback_done_event.wait)app.add_handler(TypeHandler(object,callback))thread=Thread(target=thread_target)thread.start()ifmethod=="polling":app.run_polling(close_loop=False,drop_pending_updates=True)else:ip="127.0.0.1"port=randrange(1024,49152)app.run_webhook(ip_address=ip,port=port,url_path="TOKEN",drop_pending_updates=False,close_loop=False,            )thread.join()assertlen(assertions)==5forkey,valueinassertions.items():>assertvalue,f"assertion '{key}' failed!"EAssertionError:assertion'updater.stop_event'failed!EassertFalsetests/ext/test_application.py:2547:AssertionError

To view more test analytics, go to theTest Analytics Dashboard
📢 Thoughts on this report?Let us know!

Copy link
MemberAuthor

@Bibo-JoshiBibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've now merged everything in the "master" api-8.0 PR, given it another once-over and compared with the html diff from the channel. LGTM now.
Additional reviews are very welcome! the individual prs should be fine for that, I've only changed a handful of things directly in this PR here

@Bibo-JoshiBibo-Joshi merged commitef1685c intomasterDec 1, 2024
24 checks passed
@Bibo-JoshiBibo-Joshi deleted the api-8.0 branchDecember 1, 2024 09:26
@s750Bot

This comment was marked as spam.

@s750Bot

This comment was marked as spam.

cuevasrja added a commit to USB-CI3715/python-telegram-bot that referenced this pull requestDec 13, 2024
…cia entre módulos (#1)* Refactor datetime imports to use alias for consistency* Refactor datetime imports to use alias for consistency across modules* Refactor datetime imports to use alias for consistency in ChatMemberUpdated, Giveaway, Message, MessageOrigin modules* Refactor datetime imports to use alias for consistency in ChatJoinRequest and ChatMember modules* Full Support for Bot API 8.0 (python-telegram-bot#4566,python-telegram-bot#4568,python-telegram-bot#4570,python-telegram-bot#4571,python-telegram-bot#4574,python-telegram-bot#4576,python-telegram-bot#4572)* Documentation Improvements (python-telegram-bot#4573,python-telegram-bot#4565)Co-authored-by: Snehashish Biswas <coderrx06@gmail.com>Co-authored-by: poolitzer <github@poolitzer.eu>* Bump Version to v21.8 (python-telegram-bot#4583)* Bump `srvaroa/labeler` from 1.11.1 to 1.12.0 (python-telegram-bot#4586)Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>* Bump `pylint` to v3.3.2 to Improve Python 3.13 Support (python-telegram-bot#4590)* Bump `codecov/codecov-action` from 4 to 5 (python-telegram-bot#4585)Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>* Allow `Sequence` Input for `allowed_updates` in `Application` and `Updater` Methods (python-telegram-bot#4589)* Full Support for Bot API 8.1 (python-telegram-bot#4594)* Use `MessageLimit.DEEP_LINK_LENGTH` in `helpers.create_deep_linked_url` (python-telegram-bot#4597)* Bump `pytest` from 8.3.3 to 8.3.4 (python-telegram-bot#4596)Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>* Update `aiolimiter` requirement from ~=1.1.0 to >=1.1,<1.3 (python-telegram-bot#4595)Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>* Bump Version to v21.9 (python-telegram-bot#4601)* Reorder imports to unify `datetime`  usage across modules---------Signed-off-by: dependabot[bot] <support@github.com>Co-authored-by: Bibo-Joshi <22366557+Bibo-Joshi@users.noreply.github.com>Co-authored-by: Snehashish Biswas <coderrx06@gmail.com>Co-authored-by: poolitzer <github@poolitzer.eu>Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Co-authored-by: Luis Pérez <luis.i.perez.0@gmail.com>Co-authored-by: dependabot[bot] <dependabot[bot]@users.noreply.github.com>Co-authored-by: Juan Andrés Cuevas <juanandrescuevas14@gmail.com>
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsDec 15, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers
No reviews
Assignees
No one assigned
Labels
⚙️ bot-apiaffected functionality: bot-api🔌 enhancementpr description: enhancement
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Bot API 8.0
2 participants
@Bibo-Joshi@s750Bot

[8]ページ先頭

©2009-2025 Movatter.jp