Updated docstring in deleteMessage methods (#618)

* Removed "undocumented" notice

* Updated docstring according to Bot API documentation

* Removed extra line
This commit is contained in:
Evgen 2017-05-19 23:21:20 +05:00 committed by Jannes Höke
parent 9aa5522694
commit c2c5452829
4 changed files with 7 additions and 12 deletions

View file

@ -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.

View file

@ -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.

View file

@ -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)

View file

@ -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):