Complete Bot API 10.0 Guest Mode: SentGuestMessage, answer_guest_query, filter#5234
Conversation
…SAGE filter Completes Bot API 10.0 Guest Mode support on top of the WIP commit in api-10.0-guest by introducing the missing pieces: - `telegram.SentGuestMessage` for the answerGuestQuery return type. - `telegram.Bot.answer_guest_query` (+ `answerGuestQuery` camelCase alias) and the rate-limited wrapper on `telegram.ext.ExtBot`. - `telegram.ext.filters.UpdateType.GUEST_MESSAGE` and inclusion of `update.guest_message` in `UpdateType.ALL`. - Docs entry and chango fragment closing python-telegram-bot#5228. - Unit tests for the new class, bot method and filter, plus a dummy entry in `tests/auxil/dummy_objects.py`.
harshil21
left a comment
There was a problem hiding this comment.
Thanks for the PR! The changes themselves look quite good, just a few more touchups needed.
Can you also fix the failing tests?
… test, revert channel_post in effective_user - Rename changes/unreleased/5228.*.toml -> 5234.*.toml so the chango action recognizes it (file must be named after the PR number). - Exclude guest_bot_caller_chat, guest_bot_caller_user, and guest_query_id from is_type_attribute since these are metadata, not message types. - Remove channel_post from the effective_user chain in Update; the api-10.0-central baseline did not include it and adding it regressed test_messagehandler::test_context.
|
Pushed 61625f0 to address the failing CI checks:
The remaining |
- Shorten SentGuestMessage class docstring - Shorten Bot.answer_guest_query method docstring - Assert GUEST_MESSAGE filter is False in other UpdateType filter tests - Add test_answer_guest_query_defaults modeled on the web_app_query variant
Hi, thank you! I addressed your comments, but some tests are still failing, even in master, without this change. Anything I should do about them? |
harshil21
left a comment
There was a problem hiding this comment.
Thanks for the quick changes! You don't need to worry about the failing tests on master, everything looks good now.
532e897
into
python-telegram-bot:api-10.0-guest
Builds on top of the existing WIP commit on
api-10.0-guest(a7ff5fb "Almost everything in guest mode") and adds the remaining pieces needed to fully cover Bot API 10.0 Guest Mode. Closes #5228.Summary
telegram.SentGuestMessage(return type ofanswerGuestQuery).Bot.answer_guest_querywith theanswerGuestQuerycamelCase alias, plus the rate-limited wrapper onExtBot.telegram.ext.filters.UpdateType.GUEST_MESSAGEand includeupdate.guest_messageinUpdateType.ALL.docs/source/telegram.sentguestmessage.rst) and register in the toctree.SentGuestMessageentry intests/auxil/dummy_objects.py).The pre-existing types (
Update.guest_message,Message.is_guest,User.is_guest, related constants) and registered allowed-update string were already added by @Poolitzer in a7ff5fb — this PR layers the missing surface on top so the API is end-to-end usable.Test plan
pytest tests/test_sentguestmessage.py— passes.pytest tests/test_bot.py -k "test_answer_guest_query or test_answer_web_app_query"— passes.pytest tests/ext/test_filters.py -k "test_update_type_guest_message"— passes.pytest tests/test_bot.py tests/test_sentguestmessage.py tests/ext/test_filters.py tests/test_official/— 2020 passed; only failures are pre-existing flaky integration tests hitting flood-control on the real Bot API (unrelated to this change).uid = "PR_NUMBER"inchanges/unreleased/5228.*.tomlto this PR's number before merging.