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')
|
||||
tb.send_video(chat_id, video)
|
||||
|
||||
# sendLocation
|
||||
tb.send_location(chat_id, lat, lon)
|
||||
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
@ -179,5 +179,5 @@ class TeleBot:
|
||||
"""
|
||||
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)
|
||||
|
@ -42,7 +42,7 @@ def get_updates(token):
|
||||
method_url = r'getUpdates'
|
||||
request_url = api_url + 'bot' + token + '/' + method_url
|
||||
req = requests.get(request_url)
|
||||
return check_result(method_url,req)
|
||||
return check_result(method_url, req)
|
||||
|
||||
|
||||
def forward_message(token, chat_id, from_chat_id, message_id):
|
||||
@ -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)
|
||||
|
||||
|
||||
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):
|
||||
api_url = telebot.API_URL
|
||||
method_url = get_method_by_type(data_type)
|
||||
|
Loading…
Reference in New Issue
Block a user