diff --git a/telegram/bot.py b/telegram/bot.py index b60f6e41a..e6da982f0 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -244,7 +244,13 @@ class Bot(TelegramObject): @log @message def delete_message(self, chat_id, message_id): - """Use this method to delete messages which were sent not later than 48 hours ago. + """Use this method to delete a message. A message can only be deleted if it was sent less + than 48 hours ago. Any such recently sent outgoing message may be deleted. Additionally, + if the bot is an administrator in a group chat, it can delete any message. If the bot is + an administrator in a supergroup, it can delete messages from any other user and service + messages about people joining or leaving the group (other types of service messages may + only be removed by the group creator). In channels, bots can only remove their own + messages. Args: chat_id (int|str): Unique identifier for the target chat or @@ -252,10 +258,6 @@ class Bot(TelegramObject): @channelusername). message_id (int): Unique message identifier. - Note: - This method is not documented, so it's not guaranteed to work. Also, its behaviour can - be changed at any time. - Returns: bool: On success, `True` is returned. diff --git a/telegram/message.py b/telegram/message.py index b2f7d8531..f52b06527 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -551,10 +551,6 @@ class Message(TelegramObject): ... message_id=message.message_id, ... *args, **kwargs) - Note: - This method is not documented, so it's not guaranteed to work. Also, its behaviour can - be changed at any time. - Returns: bool: On success, `True` is returned. diff --git a/tests/test_bot.py b/tests/test_bot.py index a9d5b6ba8..a3ddb5108 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -96,8 +96,6 @@ class BotTest(BaseTest, unittest.TestCase): @timeout(10) def test_deleteMessage_old_message(self): with self.assertRaisesRegexp(telegram.TelegramError, "can't be deleted"): - # NOTE: This behaviour can be changed in future because `deleteMessage` method is not - # documented in Bot API reference now. # Considering that the first message is old enough self._bot.delete_message(chat_id=self._chat_id, message_id=1) diff --git a/tests/test_message.py b/tests/test_message.py index 453498037..5109aeab5 100644 --- a/tests/test_message.py +++ b/tests/test_message.py @@ -152,7 +152,6 @@ class MessageTest(BaseTest, unittest.TestCase): reply_to_message_id=1) with self.assertRaisesRegexp(telegram.TelegramError, "can't be deleted"): - # NOTE: This behaviour can be changed in future. See `tests/test_bot.py` for more info message.reply_to_message.delete() def test_equality(self):