-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Bot API 10.0: Guest Mode #5239
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: api-10.0-central
Are you sure you want to change the base?
Bot API 10.0: Guest Mode #5239
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| features = "Added the class :class:`telegram.SentGuestMessage` and the method :meth:`telegram.Bot.answer_guest_query` as well as the filter :attr:`telegram.ext.filters.UpdateType.GUEST_MESSAGE` for Bot API 10.0 Guest Mode support." | ||
| [[pull_requests]] | ||
| uid = "5234" | ||
| author_uids = ["Phil9l"] | ||
| closes_threads = ["5228"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| SentGuestMessage | ||
| ================ | ||
|
|
||
| .. autoclass:: telegram.SentGuestMessage | ||
| :members: | ||
| :show-inheritance: |
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a shortcut for |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -707,6 +707,21 @@ class Message(MaybeInaccessibleMessage): | |||||||||||||
| managed_bot_created (:class:`telegram.ManagedBotCreated`, optional): Service message: user | ||||||||||||||
| created a bot that will be managed by the current bot. | ||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_bot_caller_user (:class:`telegram.User`, optional): For a message sent by a guest | ||||||||||||||
| bot, this is the user whose original message triggered the bot's response. | ||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_bot_caller_chat (:class:`telegram.Chat`, optional): For a message sent by a guest | ||||||||||||||
| bot, this is the user whose original message triggered the bot's response. | ||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_query_id (:obj:`str`, optional): The unique identifier for the guest query. Use this | ||||||||||||||
| identifier with the method :meth:`telegram.Bot.answer_guest_query` to send a response | ||||||||||||||
| message. If non-empty, the message belongs to a chat of the corresponding business | ||||||||||||||
| account that is independent from any potential bot chat which might share the same | ||||||||||||||
| identifier. | ||||||||||||||
|
Comment on lines
+721
to
+723
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
|
|
||||||||||||||
| Attributes: | ||||||||||||||
|
|
@@ -1139,6 +1154,21 @@ class Message(MaybeInaccessibleMessage): | |||||||||||||
| managed_bot_created (:class:`telegram.ManagedBotCreated`): Optional. Service message: user | ||||||||||||||
| created a bot that will be managed by the current bot. | ||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_bot_caller_user (:class:`telegram.User`): Optional. For a message sent by a guest | ||||||||||||||
| bot, this is the user whose original message triggered the bot's response. | ||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_bot_caller_chat (:class:`telegram.Chat`): Optional. For a message sent by a guest | ||||||||||||||
| bot, this is the user whose original message triggered the bot's response. | ||||||||||||||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
| guest_query_id (:obj:`str`): Optional. The unique identifier for the guest query. Use this | ||||||||||||||
| identifier with the method :meth:`telegram.Bot.answer_guest_query` to send a response | ||||||||||||||
| message. If non-empty, the message belongs to a chat of the corresponding business | ||||||||||||||
| account that is independent from any potential bot chat which might share the same | ||||||||||||||
| identifier. | ||||||||||||||
|
Comment on lines
+1168
to
+1170
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| .. versionadded:: NEXT.VERSION | ||||||||||||||
|
|
||||||||||||||
| .. |custom_emoji_no_md1_support| replace:: Since custom emoji entities are not supported by | ||||||||||||||
|
|
@@ -1201,6 +1231,9 @@ class Message(MaybeInaccessibleMessage): | |||||||||||||
| "giveaway_created", | ||||||||||||||
| "giveaway_winners", | ||||||||||||||
| "group_chat_created", | ||||||||||||||
| "guest_bot_caller_chat", | ||||||||||||||
| "guest_bot_caller_user", | ||||||||||||||
| "guest_query_id", | ||||||||||||||
| "has_media_spoiler", | ||||||||||||||
| "has_protected_content", | ||||||||||||||
| "invoice", | ||||||||||||||
|
|
@@ -1380,6 +1413,9 @@ def __init__( | |||||||||||||
| poll_option_deleted: PollOptionDeleted | None = None, | ||||||||||||||
| reply_to_poll_option_id: str | None = None, | ||||||||||||||
| managed_bot_created: ManagedBotCreated | None = None, | ||||||||||||||
| guest_bot_caller_user: User | None = None, | ||||||||||||||
| guest_bot_caller_chat: Chat | None = None, | ||||||||||||||
| guest_query_id: str | None = None, | ||||||||||||||
| *, | ||||||||||||||
| api_kwargs: JSONDict | None = None, | ||||||||||||||
| ): | ||||||||||||||
|
|
@@ -1514,6 +1550,9 @@ def __init__( | |||||||||||||
| self.poll_option_deleted: PollOptionDeleted | None = poll_option_deleted | ||||||||||||||
| self.reply_to_poll_option_id: str | None = reply_to_poll_option_id | ||||||||||||||
| self.managed_bot_created: ManagedBotCreated | None = managed_bot_created | ||||||||||||||
| self.guest_bot_caller_user: User | None = guest_bot_caller_user | ||||||||||||||
| self.guest_bot_caller_chat: Chat | None = guest_bot_caller_chat | ||||||||||||||
| self.guest_query_id: str | None = guest_query_id | ||||||||||||||
|
|
||||||||||||||
| self._effective_attachment = DEFAULT_NONE | ||||||||||||||
|
|
||||||||||||||
|
|
@@ -1743,6 +1782,12 @@ def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "Message": | |||||||||||||
| data["managed_bot_created"] = de_json_optional( | ||||||||||||||
| data.get("managed_bot_created"), ManagedBotCreated, bot | ||||||||||||||
| ) | ||||||||||||||
| data["guest_bot_caller_user"] = de_json_optional( | ||||||||||||||
| data.get("guest_bot_caller_user"), User, bot | ||||||||||||||
| ) | ||||||||||||||
| data["guest_bot_caller_chat"] = de_json_optional( | ||||||||||||||
| data.get("guest_bot_caller_chat"), Chat, bot | ||||||||||||||
| ) | ||||||||||||||
|
|
||||||||||||||
| api_kwargs = {} | ||||||||||||||
| # This is a deprecated field that TG still returns for backwards compatibility | ||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| #!/usr/bin/env python | ||
| # | ||
| # A library that provides a Python interface to the Telegram Bot API | ||
| # Copyright (C) 2015-2026 | ||
| # Leandro Toledo de Souza <devs@python-telegram-bot.org> | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU Lesser Public License as published by | ||
| # the Free Software Foundation, either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU Lesser Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Lesser Public License | ||
| # along with this program. If not, see [http://www.gnu.org/licenses/]. | ||
| """This module contains an object that represents a Telegram Sent Guest Message.""" | ||
|
|
||
| from telegram._telegramobject import TelegramObject | ||
| from telegram._utils.types import JSONDict | ||
|
|
||
|
|
||
| class SentGuestMessage(TelegramObject): | ||
| """Describes an inline message sent by a guest bot. | ||
|
|
||
| Objects of this class are comparable in terms of equality. Two objects of this class are | ||
| considered equal, if their :attr:`inline_message_id` are equal. | ||
|
|
||
| .. versionadded:: NEXT.VERSION | ||
|
|
||
| Args: | ||
| inline_message_id (:obj:`str`): Identifier of the sent inline message. | ||
|
|
||
| Attributes: | ||
| inline_message_id (:obj:`str`): Identifier of the sent inline message. | ||
| """ | ||
|
|
||
| __slots__ = ("inline_message_id",) | ||
|
|
||
| def __init__( | ||
| self, | ||
| inline_message_id: str, | ||
| *, | ||
| api_kwargs: JSONDict | None = None, | ||
| ): | ||
| super().__init__(api_kwargs=api_kwargs) | ||
| # Required | ||
| self.inline_message_id: str = inline_message_id | ||
|
|
||
| self._id_attrs = (self.inline_message_id,) | ||
|
|
||
| self._freeze() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.