mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
sendLocation method supported.
This commit is contained in:
parent
343b8ebc85
commit
cd0b85c03c
@ -101,6 +101,9 @@ tb.send_sticker(chat_id, sti)
|
|||||||
video = open('/tmp/video.mp4', 'rb')
|
video = open('/tmp/video.mp4', 'rb')
|
||||||
tb.send_video(chat_id, video)
|
tb.send_video(chat_id, video)
|
||||||
|
|
||||||
|
# sendLocation
|
||||||
|
tb.send_location(chat_id, lat, lon)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
@ -179,5 +179,5 @@ class TeleBot:
|
|||||||
"""
|
"""
|
||||||
return apihelper.send_data(self.token, chat_id, data, 'video', reply_to_message_id, reply_markup)
|
return apihelper.send_data(self.token, chat_id, data, 'video', reply_to_message_id, reply_markup)
|
||||||
|
|
||||||
|
def send_location(self, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None):
|
||||||
|
return apihelper.send_location(self.token, chat_id, latitude, longitude, reply_to_message_id, reply_markup)
|
||||||
|
@ -70,6 +70,19 @@ def send_photo(token, chat_id, photo, caption=None, reply_to_message_id=None, re
|
|||||||
return check_result(method_url, req)
|
return check_result(method_url, req)
|
||||||
|
|
||||||
|
|
||||||
|
def send_location(token, chat_id, latitude, longitude, reply_to_message_id=None, reply_markup=None):
|
||||||
|
api_url = telebot.API_URL
|
||||||
|
method_url = r'sendLocation'
|
||||||
|
request_url = api_url + 'bot' + token + '/' + method_url
|
||||||
|
payload = {'chat_id': chat_id, 'latitude': latitude, 'longitude': longitude}
|
||||||
|
if reply_to_message_id:
|
||||||
|
payload['reply_to_message_id'] = reply_to_message_id
|
||||||
|
if reply_markup:
|
||||||
|
payload['reply_markup'] = reply_markup
|
||||||
|
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):
|
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None):
|
||||||
api_url = telebot.API_URL
|
api_url = telebot.API_URL
|
||||||
method_url = get_method_by_type(data_type)
|
method_url = get_method_by_type(data_type)
|
||||||
|
Loading…
Reference in New Issue
Block a user