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:
commit
6d18a2c22f
@ -33,6 +33,7 @@ class TeleBot:
|
||||
getMe
|
||||
sendMessage
|
||||
forwardMessage
|
||||
deleteMessage
|
||||
sendPhoto
|
||||
sendAudio
|
||||
sendDocument
|
||||
@ -408,6 +409,15 @@ class TeleBot:
|
||||
return types.Message.de_json(
|
||||
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,
|
||||
disable_notification=None):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
||||
|
||||
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
|
||||
|
||||
def send_game(token, chat_id, game_short_name, disable_notification=None, reply_to_message_id=None, reply_markup=None):
|
||||
|
Loading…
Reference in New Issue
Block a user