From 2e743b4b86462afb4b545f434590eefcec912421 Mon Sep 17 00:00:00 2001 From: eternnoir Date: Sun, 6 Aug 2017 15:22:23 +0800 Subject: [PATCH] Add v3.2 method. --- telebot/__init__.py | 24 ++++++++++++------------ telebot/apihelper.py | 30 ++++++++++++++++-------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 9a05d67..671f103 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -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): """ diff --git a/telebot/apihelper.py b/telebot/apihelper.py index af0506d..ea7bedc 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -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: