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

Add v3.2 method.

This commit is contained in:
eternnoir 2017-08-06 15:22:23 +08:00
parent af70313721
commit 2e743b4b86
2 changed files with 28 additions and 26 deletions

View File

@ -873,18 +873,18 @@ class TeleBot:
"""
return apihelper.answer_callback_query(self.token, callback_query_id, text, show_alert, url, cache_time)
def send_sticker(self, chat_id, sticker, disable_notification=None, reply_to_message_id=None, reply_markup=None):
"""
Use this method to send .webp stickers. On success, the sent Message is returned.
:param chat_id:
:param sticker:
:param disable_notification:
:param reply_to_message_id:
:param reply_markup:
:return:
"""
result = apihelper.send_sticker(self.token, chat_id, sticker, disable_notification, reply_markup, reply_markup)
return types.Message.de_json(result)
# def send_sticker(self, chat_id, sticker, disable_notification=None, reply_to_message_id=None, reply_markup=None):
# """
# Use this method to send .webp stickers. On success, the sent Message is returned.
# :param chat_id:
# :param sticker:
# :param disable_notification:
# :param reply_to_message_id:
# :param reply_markup:
# :return:
# """
# result = apihelper.send_sticker(self.token, chat_id, sticker, disable_notification, reply_markup, reply_markup)
# return types.Message.de_json(result)
def get_sticker_set(self, name):
"""

View File

@ -791,20 +791,20 @@ def answer_inline_query(token, inline_query_id, results, cache_time=None, is_per
return _make_request(token, method_url, params=payload, method='post')
def send_sticker(token, chat_id, sticker, disable_notification=None, reply_to_message_id=None, reply_markup=None):
method_url = 'sendSticker'
payload = {'chat_id': chat_id}
if not util.is_string(sticker):
files = {'sticker': sticker}
else:
payload['sticker'] = sticker
if disable_notification:
payload['disable_notification'] = disable_notification
if reply_to_message_id:
payload['reply_to_message_id'] = reply_to_message_id
if reply_markup:
payload['reply_markup'] = _convert_markup(reply_markup)
return _make_request(token, method_url, params=payload, files=files, method='post')
# def send_sticker(token, chat_id, sticker, disable_notification=None, reply_to_message_id=None, reply_markup=None):
# method_url = 'sendSticker'
# payload = {'chat_id': chat_id}
# if not util.is_string(sticker):
# files = {'sticker': sticker}
# else:
# payload['sticker'] = sticker
# if disable_notification:
# payload['disable_notification'] = disable_notification
# if reply_to_message_id:
# payload['reply_to_message_id'] = reply_to_message_id
# if reply_markup:
# payload['reply_markup'] = _convert_markup(reply_markup)
# return _make_request(token, method_url, params=payload, files=files, method='post')
def get_sticker_set(token, name):
@ -822,6 +822,7 @@ def upload_sticker_file(token, user_id, png_sticker):
def create_new_sticker_set(token, user_id, name, title, png_sticker, emojis, contains_masks=None, mask_position=None):
method_url = 'createNewStickerSet'
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
files = None
if not util.is_string(png_sticker):
files = {'png_sticker': png_sticker}
else:
@ -836,6 +837,7 @@ def create_new_sticker_set(token, user_id, name, title, png_sticker, emojis, con
def add_sticker_to_set(token, user_id, name, png_sticker, emojis, mask_position):
method_url = 'addStickerToSet'
payload = {'user_id': user_id, 'name': name, 'emojis': emojis}
files = None
if not util.is_string(png_sticker):
files = {'png_sticker': png_sticker}
else: