diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 0e76a67..67a8e7c 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -1536,8 +1536,14 @@ def create_new_sticker_set( contains_masks=None, mask_position=None, webm_sticker=None): method_url = 'createNewStickerSet' payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis} - stype = 'png_sticker' if png_sticker else 'tgs_sticker' - sticker = png_sticker or tgs_sticker + stype = None + if png_sticker: + stype = 'png_sticker' + elif webm_sticker: + stype = 'webm_sticker' + else: + stype = 'tgs_sticker' + sticker = png_sticker or tgs_sticker or webm_sticker files = None if not util.is_string(sticker): files = {stype: sticker} @@ -1555,8 +1561,14 @@ def create_new_sticker_set( def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker): method_url = 'addStickerToSet' payload = {'user_id': user_id, 'name': name, 'emojis': emojis} - stype = 'png_sticker' if png_sticker else 'tgs_sticker' - sticker = png_sticker or tgs_sticker + stype = None + if png_sticker: + stype = 'png_sticker' + elif webm_sticker: + stype = 'webm_sticker' + else: + stype = 'tgs_sticker' + sticker = png_sticker or tgs_sticker or webm_sticker files = None if not util.is_string(sticker): files = {stype: sticker} @@ -1564,8 +1576,6 @@ def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, m payload[stype] = sticker if mask_position: payload['mask_position'] = mask_position.to_json() - if webm_sticker: - payload['webm_sticker'] = webm_sticker return _make_request(token, method_url, params=payload, files=files, method='post') diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index a5fdb5a..591410c 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -1500,8 +1500,14 @@ async def create_new_sticker_set( contains_masks=None, mask_position=None, webm_sticker=None): method_url = 'createNewStickerSet' payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis} - stype = 'png_sticker' if png_sticker else 'tgs_sticker' - sticker = png_sticker or tgs_sticker + stype = None + if png_sticker: + stype = 'png_sticker' + elif webm_sticker: + stype = 'webm_sticker' + else: + stype = 'tgs_sticker' + sticker = png_sticker or tgs_sticker or webm_sticker files = None if not util.is_string(sticker): files = {stype: sticker} @@ -1519,9 +1525,16 @@ async def create_new_sticker_set( async def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker): method_url = 'addStickerToSet' payload = {'user_id': user_id, 'name': name, 'emojis': emojis} - stype = 'png_sticker' if png_sticker else 'tgs_sticker' - sticker = png_sticker or tgs_sticker + stype = None + if png_sticker: + stype = 'png_sticker' + elif webm_sticker: + stype = 'webm_sticker' + else: + stype = 'tgs_sticker' files = None + sticker = png_sticker or tgs_sticker or webm_sticker + if not util.is_string(sticker): files = {stype: sticker} else: diff --git a/telebot/types.py b/telebot/types.py index 1cce817..15cd2d1 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -2508,7 +2508,7 @@ class Sticker(JsonDeserializable): return cls(**obj) def __init__(self, file_id, file_unique_id, width, height, is_animated, - is_video=None, thumb=None, emoji=None, set_name=None, mask_position=None, file_size=None, **kwargs): + is_video, thumb=None, emoji=None, set_name=None, mask_position=None, file_size=None, **kwargs): self.file_id: str = file_id self.file_unique_id: str = file_unique_id self.width: int = width