8000 feat: add the field `is_from_offline` to the class `Message` by mahdyar · Pull Request #4189 · python-telegram-bot/python-telegram-bot · GitHub
[go: up one dir, main page]

Skip to content

feat: add the field is_from_offline to the class Message #4189

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

Merged
merged 5 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions telegram/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@ class Message(MaybeInaccessibleMessage):
forwarded.

.. versionadded:: 13.9
is_from_offline (:obj:`bool`, optional): :obj:`True`, if the message was sent
by an implicit action, for example, as an away or a greeting business message,
or as a scheduled message.
media_group_id (:obj:`str`, optional): The unique identifier of a media message group this
message belongs to.
text (:obj:`str`, optional): For text messages, the actual UTF-8 text of the message,
Expand Down Expand Up @@ -581,6 +584,9 @@ class Message(MaybeInaccessibleMessage):
forwarded.

.. versionadded:: 13.9
is_from_offline (:obj:`bool`): Optional. :obj:`True`, if the message was sent
by an implicit action, for example, as an away or a greeting business message,
or as a scheduled message.
media_group_id (:obj:`str`): Optional. The unique identifier of a media message group this
message belongs to.
text (:obj:`str`): Optional. For text messages, the actual UTF-8 text of the message,
Expand Down Expand Up @@ -890,6 +896,7 @@ class Message(MaybeInaccessibleMessage):
"has_protected_content",
"invoice",
"is_automatic_forward",
"is_from_offline",
"is_topic_message",
"left_chat_member",
"link_preview_options",
Expand Down Expand Up @@ -1014,6 +1021,7 @@ def __init__(
sender_boost_count: Optional[int] = None,
business_connection_id: Optional[str] = None,
sender_business_bot: Optional[User] = None,
is_from_offline: Optional[bool] = None,
*,
api_kwargs: Optional[JSONDict] = None,
):
Expand Down Expand Up @@ -1111,6 +1119,7 @@ def __init__(
self.sender_boost_count: Optional[int] = sender_boost_count
self.business_connection_id: Optional[str] = business_connection_id
self.sender_business_bot: Optional[User] = sender_business_bot
self.is_from_offline: Optional[bool] = is_from_offline

self._effective_attachment = DEFAULT_NONE

Expand Down
1 change: 1 addition & 0 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def is_type_attribute(name: str) -> bool:
# attribute is deprecated, no need to add it to MessageType
"user_shared",
"via_bot",
"is_from_offline",
}:
return False

Expand Down
2 changes: 2 additions & 0 deletions tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def message(bot):
{"reply_to_story": Story(Chat(1, Chat.PRIVATE), 0)},
{"boost_added": ChatBoostAdded(100)},
{"sender_boost_count": 1},
{"is_from_offline": True},
{"sender_business_bot": User(1, "BusinessBot", True)},
{"business_connection_id": "123456789"},
],
Expand Down Expand Up @@ -332,6 +333,7 @@ def message(bot):
"sender_boost_count",
"sender_business_bot",
"business_connection_id",
"is_from_offline",
],
)
def message_params(bot, request):
Expand Down
0