mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Fixes regarding contains_masks
This commit is contained in:
parent
737c3a439d
commit
dd4073fd74
@ -4279,9 +4279,14 @@ class TeleBot:
|
|||||||
:return: On success, True is returned.
|
:return: On success, True is returned.
|
||||||
:rtype: :obj:`bool`
|
:rtype: :obj:`bool`
|
||||||
"""
|
"""
|
||||||
|
if contains_masks is not None:
|
||||||
|
logger.warning('The parameter "contains_masks" is deprecated, use "sticker_type" instead')
|
||||||
|
if sticker_type is None:
|
||||||
|
sticker_type = 'mask'
|
||||||
|
|
||||||
return apihelper.create_new_sticker_set(
|
return apihelper.create_new_sticker_set(
|
||||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||||
contains_masks, mask_position, webm_sticker, sticker_type)
|
mask_position, webm_sticker, sticker_type)
|
||||||
|
|
||||||
def add_sticker_to_set(
|
def add_sticker_to_set(
|
||||||
self, user_id: int, name: str, emojis: str,
|
self, user_id: int, name: str, emojis: str,
|
||||||
|
@ -1574,7 +1574,7 @@ def upload_sticker_file(token, user_id, png_sticker):
|
|||||||
|
|
||||||
def create_new_sticker_set(
|
def create_new_sticker_set(
|
||||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||||
contains_masks=None, mask_position=None, webm_sticker=None, sticker_type=None):
|
mask_position=None, webm_sticker=None, sticker_type=None):
|
||||||
method_url = 'createNewStickerSet'
|
method_url = 'createNewStickerSet'
|
||||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
||||||
if png_sticker:
|
if png_sticker:
|
||||||
@ -1589,8 +1589,6 @@ def create_new_sticker_set(
|
|||||||
files = {stype: sticker}
|
files = {stype: sticker}
|
||||||
else:
|
else:
|
||||||
payload[stype] = sticker
|
payload[stype] = sticker
|
||||||
if contains_masks is not None:
|
|
||||||
payload['contains_masks'] = contains_masks
|
|
||||||
if mask_position:
|
if mask_position:
|
||||||
payload['mask_position'] = mask_position.to_json()
|
payload['mask_position'] = mask_position.to_json()
|
||||||
if webm_sticker:
|
if webm_sticker:
|
||||||
|
@ -5117,9 +5117,14 @@ class AsyncTeleBot:
|
|||||||
:return: On success, True is returned.
|
:return: On success, True is returned.
|
||||||
:rtype: :obj:`bool`
|
:rtype: :obj:`bool`
|
||||||
"""
|
"""
|
||||||
|
if contains_masks is not None:
|
||||||
|
logger.warning('The parameter "contains_masks" is deprecated, use "sticker_type" instead')
|
||||||
|
if sticker_type is None:
|
||||||
|
sticker_type = 'mask'
|
||||||
|
|
||||||
return await asyncio_helper.create_new_sticker_set(
|
return await asyncio_helper.create_new_sticker_set(
|
||||||
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||||
contains_masks, mask_position, webm_sticker, sticker_type)
|
mask_position, webm_sticker, sticker_type)
|
||||||
|
|
||||||
|
|
||||||
async def add_sticker_to_set(
|
async def add_sticker_to_set(
|
||||||
|
@ -1545,7 +1545,7 @@ async def upload_sticker_file(token, user_id, png_sticker):
|
|||||||
|
|
||||||
async def create_new_sticker_set(
|
async def create_new_sticker_set(
|
||||||
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
token, user_id, name, title, emojis, png_sticker, tgs_sticker,
|
||||||
contains_masks=None, mask_position=None, webm_sticker=None, sticker_type=None):
|
mask_position=None, webm_sticker=None, sticker_type=None):
|
||||||
method_url = 'createNewStickerSet'
|
method_url = 'createNewStickerSet'
|
||||||
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
|
||||||
if png_sticker:
|
if png_sticker:
|
||||||
@ -1560,8 +1560,6 @@ async def create_new_sticker_set(
|
|||||||
files = {stype: sticker}
|
files = {stype: sticker}
|
||||||
else:
|
else:
|
||||||
payload[stype] = sticker
|
payload[stype] = sticker
|
||||||
if contains_masks is not None:
|
|
||||||
payload['contains_masks'] = contains_masks
|
|
||||||
if mask_position:
|
if mask_position:
|
||||||
payload['mask_position'] = mask_position.to_json()
|
payload['mask_position'] = mask_position.to_json()
|
||||||
if webm_sticker:
|
if webm_sticker:
|
||||||
|
@ -1275,7 +1275,7 @@ class MessageEntity(Dictionaryable, JsonSerializable, JsonDeserializable):
|
|||||||
:type language: :obj:`str`
|
:type language: :obj:`str`
|
||||||
|
|
||||||
:param custom_emoji_id: Optional. For “custom_emoji” only, unique identifier of the custom emoji.
|
:param custom_emoji_id: Optional. For “custom_emoji” only, unique identifier of the custom emoji.
|
||||||
Use getCustomEmojiStickers to get full information about the sticker.
|
Use get_custom_emoji_stickers to get full information about the sticker.
|
||||||
:type custom_emoji_id: :obj:`str`
|
:type custom_emoji_id: :obj:`str`
|
||||||
|
|
||||||
:return: Instance of the class
|
:return: Instance of the class
|
||||||
@ -5486,16 +5486,23 @@ class StickerSet(JsonDeserializable):
|
|||||||
obj['thumb'] = None
|
obj['thumb'] = None
|
||||||
return cls(**obj)
|
return cls(**obj)
|
||||||
|
|
||||||
def __init__(self, name, title, sticker_type, is_animated, is_video, contains_masks, stickers, thumb=None, **kwargs):
|
def __init__(self, name, title, sticker_type, is_animated, is_video, stickers, thumb=None, **kwargs):
|
||||||
self.name: str = name
|
self.name: str = name
|
||||||
self.title: str = title
|
self.title: str = title
|
||||||
self.sticker_type: str = sticker_type
|
self.sticker_type: str = sticker_type
|
||||||
self.is_animated: bool = is_animated
|
self.is_animated: bool = is_animated
|
||||||
self.is_video: bool = is_video
|
self.is_video: bool = is_video
|
||||||
self.contains_masks: bool = contains_masks
|
|
||||||
self.stickers: List[Sticker] = stickers
|
self.stickers: List[Sticker] = stickers
|
||||||
self.thumb: PhotoSize = thumb
|
self.thumb: PhotoSize = thumb
|
||||||
|
|
||||||
|
@property
|
||||||
|
def contains_masks(self):
|
||||||
|
"""
|
||||||
|
Deprecated since Bot API 6.2, use sticker_type instead.
|
||||||
|
"""
|
||||||
|
logger.warning("contains_masks is deprecated, use sticker_type instead")
|
||||||
|
return self.sticker_type == 'mask'
|
||||||
|
|
||||||
|
|
||||||
class Sticker(JsonDeserializable):
|
class Sticker(JsonDeserializable):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user