diff --git a/telebot/__init__.py b/telebot/__init__.py index 1f5288e..a102964 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -4565,7 +4565,7 @@ class TeleBot: return [types.Sticker.de_json(sticker) for sticker in result] - def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None): + def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None) -> bool: """ Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success. @@ -4581,7 +4581,7 @@ class TeleBot: """ return apihelper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id) - def set_sticker_set_title(self, name: str, title: str): + def set_sticker_set_title(self, name: str, title: str) -> bool: """ Use this method to set the title of a created sticker set. Returns True on success. @@ -4598,7 +4598,7 @@ class TeleBot: return apihelper.set_sticker_set_title(self.token, name, title) - def delete_sticker_set(self, name:str): + def delete_sticker_set(self, name:str) -> bool: """ Use this method to delete a sticker set. Returns True on success. @@ -4610,6 +4610,24 @@ class TeleBot: """ return apihelper.delete_sticker_set(self.token, name) + + def set_sticker_emoji_list(self, sticker: str, emoji_list: List[str]) -> bool: + """ + Use this method to set the emoji list of a custom emoji sticker set. + Returns True on success. + + :param sticker: Sticker identifier + :type sticker: :obj:`str` + + :param emoji_list: List of emoji + :type emoji_list: :obj:`list` of :obj:`str` + + :return: Returns True on success. + :rtype: :obj:`bool` + """ + + return apihelper.set_sticker_emoji_list(self.token, sticker, emoji_list) + def upload_sticker_file(self, user_id: int, png_sticker: Union[Any, str]=None, sticker: Optional[types.InputFile]=None, sticker_format: Optional[str]=None) -> types.File: """ diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 987be4b..8612532 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -1619,7 +1619,7 @@ def get_sticker_set(token, name): def get_custom_emoji_stickers(token, custom_emoji_ids): method_url = r'getCustomEmojiStickers' - return _make_request(token, method_url, params={'custom_emoji_ids': custom_emoji_ids}) + return _make_request(token, method_url, params={'custom_emoji_ids': json.dumps(custom_emoji_ids)}) def upload_sticker_file(token, user_id, sticker, sticker_format): method_url = 'uploadStickerFile' @@ -1646,6 +1646,11 @@ def delete_sticker_set(token, name): payload = {'name': name} return _make_request(token, method_url, params=payload, method='post') +def set_sticker_emoji_list(token, sticker, emoji_list): + method_url = 'setStickerEmojiList' + payload = {'sticker': sticker, 'emoji_list': json.dumps(emoji_list)} + return _make_request(token, method_url, params=payload, method='post') + def create_new_sticker_set( token, user_id, name, title, stickers, sticker_format=None, sticker_type=None, needs_repainting=None): method_url = 'createNewStickerSet' diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index 1576b7f..b50e987 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -5459,7 +5459,7 @@ class AsyncTeleBot: result = await asyncio_helper.upload_sticker_file(self.token, user_id, sticker, sticker_format) return types.File.de_json(result) - async def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None): + async def set_custom_emoji_sticker_set_thumbnail(self, name: str, custom_emoji_id: Optional[str]=None) -> bool: """ Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success. @@ -5475,7 +5475,7 @@ class AsyncTeleBot: """ return await asyncio_helper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id) - async def set_sticker_set_title(self, name: str, title: str): + async def set_sticker_set_title(self, name: str, title: str) -> bool: """ Use this method to set the title of a created sticker set. Returns True on success. @@ -5492,7 +5492,7 @@ class AsyncTeleBot: return await asyncio_helper.set_sticker_set_title(self.token, name, title) - async def delete_sticker_set(self, name:str): + async def delete_sticker_set(self, name:str) -> bool: """ Use this method to delete a sticker set. Returns True on success. @@ -5504,6 +5504,24 @@ class AsyncTeleBot: """ return await asyncio_helper.delete_sticker_set(self.token, name) + + + async def set_sticker_emoji_list(self, name: str, emoji_list: List[str]) -> bool: + """ + Use this method to set the emoji list of a sticker set. + Returns True on success. + + :param name: Sticker set name + :type name: :obj:`str` + + :param emoji_list: List of emojis + :type emoji_list: :obj:`list` of :obj:`str` + + :return: Returns True on success. + :rtype: :obj:`bool` + """ + + return await asyncio_helper.set_sticker_emoji_list(self.token, name, emoji_list) async def create_new_sticker_set( diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index cc0cf5b..6268fff 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -1606,7 +1606,7 @@ async def get_sticker_set(token, name): async def get_custom_emoji_stickers(token, custom_emoji_ids): method_url = r'getCustomEmojiStickers' - return await _process_request(token, method_url, params={'custom_emoji_ids': custom_emoji_ids}) + return await _process_request(token, method_url, params={'custom_emoji_ids': json.dumps(custom_emoji_ids)}) async def upload_sticker_file(token, user_id, sticker, sticker_format): method_url = 'uploadStickerFile' @@ -1614,6 +1614,10 @@ async def upload_sticker_file(token, user_id, sticker, sticker_format): files = {'sticker': sticker} return await _process_request(token, method_url, params=payload, files=files, method='post') +async def set_sticker_emoji_list(token, sticker, emoji_list): + method_url = 'setStickerEmojiList' + payload = {'sticker': sticker, 'emoji_list': json.dumps(emoji_list)} + return await _process_request(token, method_url, params=payload, method='post') async def delete_sticker_set(token, name): method_url = 'deleteStickerSet'