Skip to content

Commit 0aa963f

Browse files
Add message.content property
1 parent 1fd0d5a commit 0aa963f

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

pyrogram/types/messages_and_media/message.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,9 @@ class Message(Object, Update):
453453
454454
link (``str``, *property*):
455455
Generate a link to this message, only for groups and channels.
456+
457+
content (``str``, *property*):
458+
The text or caption content of the message.
456459
"""
457460

458461
# TODO: Add game missing field
@@ -1397,6 +1400,10 @@ def link(self) -> str:
13971400
else:
13981401
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"
13991402

1403+
@property
1404+
def content(self) -> str:
1405+
return self.text or self.caption or ""
1406+
14001407
async def get_media_group(self) -> List["types.Message"]:
14011408
"""Bound method *get_media_group* of :obj:`~pyrogram.types.Message`.
14021409

0 commit comments

Comments
 (0)