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

Added the method deleteStickerSet for complete deletion of a given sticker set that was created by the bot.

This commit is contained in:
coder2020official 2023-03-11 22:27:37 +04:00
parent 385fc6a6da
commit db087427fc
4 changed files with 36 additions and 0 deletions

View File

@ -4598,6 +4598,19 @@ class TeleBot:
return apihelper.set_sticker_set_title(self.token, name, title) return apihelper.set_sticker_set_title(self.token, name, title)
def delete_sticker_set(self, name:str):
"""
Use this method to delete a sticker set. Returns True on success.
:param name: Sticker set name
:type name: :obj:`str`
:return: Returns True on success.
:rtype: :obj:`bool`
"""
return apihelper.delete_sticker_set(self.token, name)
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: 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:
""" """
Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet

View File

@ -1641,6 +1641,11 @@ def set_sticker_set_title(token, name, title):
payload = {'name': name, 'title': title} payload = {'name': name, 'title': title}
return _make_request(token, method_url, params=payload, method='post') return _make_request(token, method_url, params=payload, method='post')
def delete_sticker_set(token, name):
method_url = 'deleteStickerSet'
payload = {'name': name}
return _make_request(token, method_url, params=payload, method='post')
def create_new_sticker_set( def create_new_sticker_set(
token, user_id, name, title, stickers, sticker_format=None, sticker_type=None, needs_repainting=None): token, user_id, name, title, stickers, sticker_format=None, sticker_type=None, needs_repainting=None):
method_url = 'createNewStickerSet' method_url = 'createNewStickerSet'

View File

@ -5492,6 +5492,19 @@ class AsyncTeleBot:
return await asyncio_helper.set_sticker_set_title(self.token, name, title) return await asyncio_helper.set_sticker_set_title(self.token, name, title)
async def delete_sticker_set(self, name:str):
"""
Use this method to delete a sticker set. Returns True on success.
:param name: Sticker set name
:type name: :obj:`str`
:return: Returns True on success.
:rtype: :obj:`bool`
"""
return await asyncio_helper.delete_sticker_set(self.token, name)
async def create_new_sticker_set( async def create_new_sticker_set(
self, user_id: int, name: str, title: str, self, user_id: int, name: str, title: str,

View File

@ -1615,6 +1615,11 @@ async def upload_sticker_file(token, user_id, sticker, sticker_format):
return await _process_request(token, method_url, params=payload, files=files, method='post') return await _process_request(token, method_url, params=payload, files=files, method='post')
async def delete_sticker_set(token, name):
method_url = 'deleteStickerSet'
payload = {'name': name}
return await _process_request(token, method_url, params=payload, method='post')
async def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None): async def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
method_url = 'setCustomEmojiStickerSetThumbnail' method_url = 'setCustomEmojiStickerSetThumbnail'
payload = {'name': name} payload = {'name': name}