1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #325 from Kylmakalle/master

Added option to delete messages.
This commit is contained in:
FrankWang 2017-05-16 16:54:34 +08:00 committed by GitHub
commit 6d18a2c22f
2 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,7 @@ class TeleBot:
getMe getMe
sendMessage sendMessage
forwardMessage forwardMessage
deleteMessage
sendPhoto sendPhoto
sendAudio sendAudio
sendDocument sendDocument
@ -408,6 +409,15 @@ class TeleBot:
return types.Message.de_json( return types.Message.de_json(
apihelper.forward_message(self.token, chat_id, from_chat_id, message_id, disable_notification)) apihelper.forward_message(self.token, chat_id, from_chat_id, message_id, disable_notification))
def delete_message(self, chat_id, message_id):
"""
Use this method to delete message. Returns True on success.
:param chat_id: in which chat to delete
:param message_id: which message to delete
:return: API reply.
"""
return apihelper.delete_message(self.token, chat_id, message_id)
def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None, def send_photo(self, chat_id, photo, caption=None, reply_to_message_id=None, reply_markup=None,
disable_notification=None): disable_notification=None):
""" """

View File

@ -446,6 +446,12 @@ def edit_message_reply_markup(token, chat_id=None, message_id=None, inline_messa
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)
def delete_message(token, chat_id=None, message_id=None):
method_url = r'deleteMessage'
payload = {'chat_id': chat_id, 'message_id': message_id}
return _make_request(token, method_url, params=payload)
# Game # Game
def send_game(token, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None): def send_game(token, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None):