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

Add provider_data to sendInvoice.

This commit is contained in:
eternnoir 2017-11-29 13:53:39 +08:00
parent 8528ca9e4e
commit 2493b200a4
2 changed files with 12 additions and 5 deletions

View File

@ -622,7 +622,8 @@ class TeleBot:
:return: API reply. :return: API reply.
""" """
return types.Message.de_json( return types.Message.de_json(
apihelper.send_location(self.token, chat_id, latitude, longitude, live_period, reply_to_message_id, reply_markup, apihelper.send_location(self.token, chat_id, latitude, longitude, live_period, reply_to_message_id,
reply_markup,
disable_notification)) disable_notification))
def edit_message_live_location(self, latitude, longitude, chat_id=None, message_id=None, def edit_message_live_location(self, latitude, longitude, chat_id=None, message_id=None,
@ -888,12 +889,12 @@ class TeleBot:
start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None, start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None,
is_flexible=None, is_flexible=None,
disable_notification=None, reply_to_message_id=None, reply_markup=None): disable_notification=None, reply_to_message_id=None, reply_markup=None, provider_data=Noen):
result = apihelper.send_invoice(self.token, chat_id, title, description, invoice_payload, provider_token, result = apihelper.send_invoice(self.token, chat_id, title, description, invoice_payload, provider_token,
currency, prices, start_parameter, photo_url, photo_size, photo_width, currency, prices, start_parameter, photo_url, photo_size, photo_width,
photo_height, photo_height,
need_name, need_phone_number, need_email, need_shipping_address, is_flexible, need_name, need_phone_number, need_email, need_shipping_address, is_flexible,
disable_notification, reply_to_message_id, reply_markup) disable_notification, reply_to_message_id, reply_markup, provider_data)
return types.Message.de_json(result) return types.Message.de_json(result)
def answer_shipping_query(self, shipping_query_id, ok, shipping_options=None, error_message=None): def answer_shipping_query(self, shipping_query_id, ok, shipping_options=None, error_message=None):
@ -1069,7 +1070,7 @@ class TeleBot:
self.pre_message_subscribers_next_step[chat_id].append(callback) self.pre_message_subscribers_next_step[chat_id].append(callback)
else: else:
self.pre_message_subscribers_next_step[chat_id] = [callback] self.pre_message_subscribers_next_step[chat_id] = [callback]
def clear_step_handler(self, message): def clear_step_handler(self, message):
""" """
Clears all callback functions registered by register_next_step_handler(). Clears all callback functions registered by register_next_step_handler().
@ -1371,6 +1372,10 @@ class AsyncTeleBot(TeleBot):
def send_video_note(self, *args, **kwargs): def send_video_note(self, *args, **kwargs):
return TeleBot.send_video_note(self, *args, **kwargs) return TeleBot.send_video_note(self, *args, **kwargs)
@util.async()
def send_media_group(self, *args, **kwargs):
return TeleBot.send_media_group(self, *args, **kwargs)
@util.async() @util.async()
def send_location(self, *args, **kwargs): def send_location(self, *args, **kwargs):
return TeleBot.send_location(self, *args, **kwargs) return TeleBot.send_location(self, *args, **kwargs)

View File

@ -710,7 +710,7 @@ def get_game_high_scores(token, user_id, chat_id=None, message_id=None, inline_m
def send_invoice(token, chat_id, title, description, invoice_payload, provider_token, currency, prices, def send_invoice(token, chat_id, title, description, invoice_payload, provider_token, currency, prices,
start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None, start_parameter, photo_url=None, photo_size=None, photo_width=None, photo_height=None,
need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, is_flexible=None, need_name=None, need_phone_number=None, need_email=None, need_shipping_address=None, is_flexible=None,
disable_notification=None, reply_to_message_id=None, reply_markup=None): disable_notification=None, reply_to_message_id=None, reply_markup=None, provider_data=None):
""" """
Use this method to send invoices. On success, the sent Message is returned. Use this method to send invoices. On success, the sent Message is returned.
:param token: Bot's token (you don't need to fill this) :param token: Bot's token (you don't need to fill this)
@ -764,6 +764,8 @@ def send_invoice(token, chat_id, title, description, invoice_payload, provider_t
payload['reply_to_message_id'] = reply_to_message_id payload['reply_to_message_id'] = reply_to_message_id
if reply_markup: if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup) payload['reply_markup'] = _convert_markup(reply_markup)
if provider_data:
payload['provider_data'] = provider_data
return _make_request(token, method_url, params=payload) return _make_request(token, method_url, params=payload)