mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Added the method setCustomEmojiStickerSetThumbnail for editing the thumbnail of custom emoji sticker sets created by the bot.
This commit is contained in:
parent
ae44b0022d
commit
ac0b386625
@ -4564,6 +4564,23 @@ class TeleBot:
|
||||
result = apihelper.get_custom_emoji_stickers(self.token, custom_emoji_ids)
|
||||
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):
|
||||
"""
|
||||
Use this method to set the thumbnail of a custom emoji sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param custom_emoji_id: Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
|
||||
:type custom_emoji_id: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return apihelper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id)
|
||||
|
||||
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
|
||||
|
@ -1628,6 +1628,13 @@ def upload_sticker_file(token, user_id, sticker, sticker_format):
|
||||
return _make_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
|
||||
method_url = 'setCustomEmojiStickerSetThumbnail'
|
||||
payload = {'name': name}
|
||||
if custom_emoji_id:
|
||||
payload['custom_emoji_id'] = custom_emoji_id
|
||||
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'
|
||||
|
@ -5459,6 +5459,22 @@ 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):
|
||||
"""
|
||||
Use this method to set the thumbnail of a custom emoji sticker set.
|
||||
Returns True on success.
|
||||
|
||||
:param name: Sticker set name
|
||||
:type name: :obj:`str`
|
||||
|
||||
:param custom_emoji_id: Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
|
||||
:type custom_emoji_id: :obj:`str`
|
||||
|
||||
:return: Returns True on success.
|
||||
:rtype: :obj:`bool`
|
||||
"""
|
||||
return await asyncio_helper.set_custom_emoji_sticker_set_thumbnail(self.token, name, custom_emoji_id)
|
||||
|
||||
async def create_new_sticker_set(
|
||||
self, user_id: int, name: str, title: str,
|
||||
emojis: Optional[str]=None,
|
||||
|
@ -1615,6 +1615,13 @@ async def upload_sticker_file(token, user_id, sticker, sticker_format):
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
async def set_custom_emoji_sticker_set_thumbnail(token, name, custom_emoji_id=None):
|
||||
method_url = 'setCustomEmojiStickerSetThumbnail'
|
||||
payload = {'name': name}
|
||||
if custom_emoji_id:
|
||||
payload['custom_emoji_id'] = custom_emoji_id
|
||||
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'
|
||||
|
Loading…
Reference in New Issue
Block a user