Skip to content

Commit

Permalink
Add message_id and chat_id properties to Message class.
Browse files Browse the repository at this point in the history
Signed-off-by: Aliwoto <[email protected]>
  • Loading branch information
Aliwoto committed Nov 2, 2023
1 parent f08404f commit 229298d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyrogram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>

__version__ = "2.0.132"
__version__ = "2.0.133"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "Copyright (C) 2017-present Dan <https://github.com/delivrance>"

Expand Down
8 changes: 8 additions & 0 deletions pyrogram/types/messages_and_media/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,14 @@ def link(self) -> str:
return f"https://t.me/{self.chat.username}/{self.id}"
else:
return f"https://t.me/c/{utils.get_channel_id(self.chat.id)}/{self.id}"

@property
def message_id(self) -> int:
return self.id

@property
def chat_id(self) -> int:
return self.chat.id

async def get_media_group(self) -> List["types.Message"]:
"""Bound method *get_media_group* of :obj:`~pyrogram.types.Message`.
Expand Down

2 comments on commit 229298d

@SpEcHiDe
Copy link
Contributor

Choose a reason for hiding this comment

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

πŸ˜‚πŸ˜‚

you still didn't get a KeyError because of this code ? πŸ€—πŸ˜

@ALiwoto
Copy link
Owner

Choose a reason for hiding this comment

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

πŸ˜‚πŸ˜‚

you still didn't get a KeyError because of this code ? πŸ€—πŸ˜

@SpEcHiDe but key error of what? because accessing self.chat? or?

Please sign in to comment.