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

Added the method setStickerSetTitle for editing the title of sticker sets created by the bot.

This commit is contained in:
coder2020official 2023-03-11 22:24:34 +04:00
parent ac0b386625
commit 385fc6a6da
4 changed files with 47 additions and 0 deletions

View File

@ -4580,6 +4580,23 @@ class TeleBot:
:rtype: :obj:`bool`
"""
return apihelper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id)
def set_sticker_set_title(self, name: str, title: str):
"""
Use this method to set the title of a created sticker set.
Returns True on success.
:param name: Sticker set name
:type name: :obj:`str`
:param title: New sticker set title
:type title: :obj:`str`
:return: Returns True on success.
:rtype: :obj:`bool`
"""
return apihelper.set_sticker_set_title(self.token, name, title)
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:
"""

View File

@ -1635,6 +1635,12 @@ def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
payload['custom_emoji_id'] = custom_emoji_id
return _make_request(token, method_url, params=payload, method='post')
def set_sticker_set_title(token, name, title):
method_url = 'setStickerSetTitle'
payload = {'name': name, 'title': title}
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'

View File

@ -5474,6 +5474,24 @@ class AsyncTeleBot:
:rtype: :obj:`bool`
"""
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):
"""
Use this method to set the title of a created sticker set.
Returns True on success.
:param name: Sticker set name
:type name: :obj:`str`
:param title: New sticker set title
:type title: :obj:`str`
:return: Returns True on success.
:rtype: :obj:`bool`
"""
return await asyncio_helper.set_sticker_set_title(self.token, name, title)
async def create_new_sticker_set(
self, user_id: int, name: str, title: str,

View File

@ -1622,6 +1622,12 @@ async def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=No
payload['custom_emoji_id'] = custom_emoji_id
return await _process_request(token, method_url, params=payload, method='post')
async def set_sticker_set_title(token, name, title):
method_url = 'setStickerSetTitle'
payload = {'name': name, 'title': title}
return await _process_request(token, method_url, params=payload, method='post')
async def create_new_sticker_set(
token, user_id, name, title, stickers, sticker_format=None, sticker_type=None, needs_repainting=None):
method_url = 'createNewStickerSet'