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

Send chat action support.

This commit is contained in:
eternnoir 2015-06-28 17:56:32 +08:00
parent e71dd24d46
commit dd0f7ab1d5
2 changed files with 19 additions and 0 deletions

View File

@ -202,3 +202,15 @@ class TeleBot:
:return:
"""
return apihelper.send_location(self.token, chat_id, latitude, longitude, reply_to_message_id, reply_markup)
def send_chat_action(self, chat_id, action):
"""
Use this method when you need to tell the user that something is happening on the bot's side.
The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear
its typing status).
:param chat_id:
:param action: string . typing,upload_photo,record_video,upload_video,record_audio,upload_audio,upload_document,
find_location.
:return:
"""
return apihelper.send_chat_action(self.token, chat_id, action)

View File

@ -82,6 +82,13 @@ def send_location(token, chat_id, latitude, longitude, reply_to_message_id=None,
req = requests.get(request_url, params=payload)
return check_result(method_url, req)
def send_chat_action(token,chat_id,action):
api_url = telebot.API_URL
method_url = r'sendChatAction'
request_url = api_url + 'bot' + token + '/' + method_url
payload = {'chat_id': chat_id, 'action': action}
req = requests.get(request_url, params=payload)
return check_result(method_url, req)
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None):
api_url = telebot.API_URL