diff --git a/AUTHORS.rst b/AUTHORS.rst index c4b7129f3..1ba3d6c97 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -105,8 +105,10 @@ The following wonderful people contributed directly or indirectly to this projec - `Vorobjev Simon `_ - `Wagner Macedo `_ - `wjt `_ +- `Yaw Danso `_ - `zeroone2numeral2 `_ - `zeshuaro `_ - `zpavloudis `_ + Please add yourself here alphabetically when you submit your first pull request. diff --git a/telegram/_message.py b/telegram/_message.py index 6bcb05261..9fec8d65e 100644 --- a/telegram/_message.py +++ b/telegram/_message.py @@ -572,6 +572,15 @@ class Message(TelegramObject): """:obj:`int`: Shortcut for :attr:`telegram.Chat.id` for :attr:`chat`.""" return self.chat.id + @property + def id(self) -> int: # pylint: disable=invalid-name + """ + :obj:`int`: Shortcut for :attr:`message_id`. + + .. versionadded:: 20.0 + """ + return self.message_id + @property def link(self) -> Optional[str]: """:obj:`str`: Convenience property. If the chat of the message is not diff --git a/tests/test_message.py b/tests/test_message.py index a9e1181de..1e904f457 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -664,6 +664,9 @@ class TestMessage: def test_chat_id(self, message): assert message.chat_id == message.chat.id + def test_id(self, message): + assert message.message_id == message.id + @pytest.mark.parametrize("type_", argvalues=[Chat.SUPERGROUP, Chat.CHANNEL]) def test_link_with_username(self, message, type_): message.chat.username = "username"