mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Bot API 5.7
This commit is contained in:
parent
723075d2da
commit
4e7652be7a
@ -2409,8 +2409,9 @@ class TeleBot:
|
||||
def create_new_sticker_set(
|
||||
self, user_id: int, name: str, title: str,
|
||||
emojis: str,
|
||||
png_sticker: Union[Any, str],
|
||||
tgs_sticker: Union[Any, str],
|
||||
png_sticker: Union[Any, str]=None,
|
||||
tgs_sticker: Union[Any, str]=None,
|
||||
webm_sticker: Union[Any, str]=None,
|
||||
contains_masks: Optional[bool]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
"""
|
||||
@ -2423,18 +2424,20 @@ class TeleBot:
|
||||
:param emojis:
|
||||
:param png_sticker:
|
||||
:param tgs_sticker:
|
||||
:param webm_sticker:
|
||||
:param contains_masks:
|
||||
:param mask_position:
|
||||
:return:
|
||||
"""
|
||||
return apihelper.create_new_sticker_set(
|
||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
contains_masks, mask_position)
|
||||
contains_masks, mask_position, webm_sticker)
|
||||
|
||||
def add_sticker_to_set(
|
||||
self, user_id: int, name: str, emojis: str,
|
||||
png_sticker: Optional[Union[Any, str]]=None,
|
||||
tgs_sticker: Optional[Union[Any, str]]=None,
|
||||
webm_sticker: Optional[Union[Any, str]]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
"""
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
@ -2445,11 +2448,12 @@ class TeleBot:
|
||||
:param emojis:
|
||||
:param png_sticker: Required if `tgs_sticker` is None
|
||||
:param tgs_sticker: Required if `png_sticker` is None
|
||||
:webm_sticker:
|
||||
:param mask_position:
|
||||
:return:
|
||||
"""
|
||||
return apihelper.add_sticker_to_set(
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position)
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker)
|
||||
|
||||
def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
||||
"""
|
||||
|
@ -1533,7 +1533,7 @@ def upload_sticker_file(token, user_id, png_sticker):
|
||||
|
||||
def create_new_sticker_set(
|
||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
contains_masks=None, mask_position=None):
|
||||
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'
|
||||
@ -1547,10 +1547,12 @@ def create_new_sticker_set(
|
||||
payload['contains_masks'] = contains_masks
|
||||
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')
|
||||
|
||||
|
||||
def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position):
|
||||
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'
|
||||
@ -1562,6 +1564,8 @@ 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')
|
||||
|
||||
|
||||
|
@ -2996,8 +2996,9 @@ class AsyncTeleBot:
|
||||
async def create_new_sticker_set(
|
||||
self, user_id: int, name: str, title: str,
|
||||
emojis: str,
|
||||
png_sticker: Union[Any, str],
|
||||
tgs_sticker: Union[Any, str],
|
||||
png_sticker: Union[Any, str]=None,
|
||||
tgs_sticker: Union[Any, str]=None,
|
||||
webm_sticker: Union[Any, str]=None,
|
||||
contains_masks: Optional[bool]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
"""
|
||||
@ -3010,19 +3011,21 @@ class AsyncTeleBot:
|
||||
:param emojis:
|
||||
:param png_sticker:
|
||||
:param tgs_sticker:
|
||||
:webm_sticker:
|
||||
:param contains_masks:
|
||||
:param mask_position:
|
||||
:return:
|
||||
"""
|
||||
return await asyncio_helper.create_new_sticker_set(
|
||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
contains_masks, mask_position)
|
||||
contains_masks, mask_position, webm_sticker)
|
||||
|
||||
|
||||
async def add_sticker_to_set(
|
||||
self, user_id: int, name: str, emojis: str,
|
||||
png_sticker: Optional[Union[Any, str]]=None,
|
||||
tgs_sticker: Optional[Union[Any, str]]=None,
|
||||
webm_sticker: Optional[Union[Any, str]]=None,
|
||||
mask_position: Optional[types.MaskPosition]=None) -> bool:
|
||||
"""
|
||||
Use this method to add a new sticker to a set created by the bot.
|
||||
@ -3033,11 +3036,12 @@ class AsyncTeleBot:
|
||||
:param emojis:
|
||||
:param png_sticker: Required if `tgs_sticker` is None
|
||||
:param tgs_sticker: Required if `png_sticker` is None
|
||||
:webm_sticker:
|
||||
:param mask_position:
|
||||
:return:
|
||||
"""
|
||||
return await asyncio_helper.add_sticker_to_set(
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position)
|
||||
self.token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position, webm_sticker)
|
||||
|
||||
|
||||
async def set_sticker_position_in_set(self, sticker: str, position: int) -> bool:
|
||||
|
@ -1497,7 +1497,7 @@ async def upload_sticker_file(token, user_id, png_sticker):
|
||||
|
||||
async def create_new_sticker_set(
|
||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||
contains_masks=None, mask_position=None):
|
||||
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'
|
||||
@ -1511,10 +1511,12 @@ async def create_new_sticker_set(
|
||||
payload['contains_masks'] = contains_masks
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
if webm_sticker:
|
||||
payload['webm_sticker'] = webm_sticker
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
async def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_sticker, mask_position):
|
||||
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'
|
||||
@ -1526,6 +1528,9 @@ async def add_sticker_to_set(token, user_id, name, emojis, png_sticker, tgs_stic
|
||||
payload[stype] = sticker
|
||||
if mask_position:
|
||||
payload['mask_position'] = mask_position.to_json()
|
||||
|
||||
if webm_sticker:
|
||||
payload['webm_sticker'] = webm_sticker
|
||||
return await _process_request(token, method_url, params=payload, files=files, method='post')
|
||||
|
||||
|
||||
|
@ -2484,10 +2484,11 @@ class StickerSet(JsonDeserializable):
|
||||
obj['thumb'] = None
|
||||
return cls(**obj)
|
||||
|
||||
def __init__(self, name, title, is_animated, contains_masks, stickers, thumb=None, **kwargs):
|
||||
def __init__(self, name, title, is_animated, is_video, contains_masks, stickers, thumb=None, **kwargs):
|
||||
self.name: str = name
|
||||
self.title: str = title
|
||||
self.is_animated: bool = is_animated
|
||||
self.is_video: bool = is_video
|
||||
self.contains_masks: bool = contains_masks
|
||||
self.stickers: List[Sticker] = stickers
|
||||
self.thumb: PhotoSize = thumb
|
||||
@ -2507,12 +2508,13 @@ class Sticker(JsonDeserializable):
|
||||
return cls(**obj)
|
||||
|
||||
def __init__(self, file_id, file_unique_id, width, height, is_animated,
|
||||
thumb=None, emoji=None, set_name=None, mask_position=None, file_size=None, **kwargs):
|
||||
is_video=None, 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
|
||||
self.height: int = height
|
||||
self.is_animated: bool = is_animated
|
||||
self.is_video: bool = is_video
|
||||
self.thumb: PhotoSize = thumb
|
||||
self.emoji: str = emoji
|
||||
self.set_name: str = set_name
|
||||
|
Loading…
Reference in New Issue
Block a user