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

Added the parameter needs_repainting to the method createNewStickerSet to automatically change the color of emoji based on context (e.g., use text color in messages, accent color in statuses, etc.).

This commit is contained in:
coder2020official 2023-03-11 16:39:04 +04:00
parent f30457bd75
commit 8a858cac4e
4 changed files with 22 additions and 6 deletions

View File

@ -4592,7 +4592,8 @@ class TeleBot:
webm_sticker: Union[Any, str]=None,
contains_masks: Optional[bool]=None,
sticker_type: Optional[str]=None,
mask_position: Optional[types.MaskPosition]=None) -> bool:
mask_position: Optional[types.MaskPosition]=None,
needs_repainting: Optional[bool]=None) -> bool:
"""
Use this method to create new sticker set owned by a user.
The bot will be able to edit the created sticker set.
@ -4635,6 +4636,11 @@ class TeleBot:
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
:type mask_position: :class:`telebot.types.MaskPosition`
:param needs_repainting: Pass True if stickers in the sticker set must be repainted to the color of text when used in messages,
the accent color if used as emoji status, white on chat photos, or another appropriate color based on context;
for custom emoji sticker sets only
:type needs_repainting: :obj:`bool`
:return: On success, True is returned.
:rtype: :obj:`bool`
"""
@ -4645,7 +4651,7 @@ class TeleBot:
return apihelper.create_new_sticker_set(
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
mask_position, webm_sticker, sticker_type)
mask_position, webm_sticker, sticker_type, needs_repainting)
def add_sticker_to_set(
self, user_id: int, name: str, emojis: str,

View File

@ -1630,7 +1630,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,
mask_position=None, webm_sticker=None, sticker_type=None):
mask_position=None, webm_sticker=None, sticker_type=None, needs_repainting=None):
method_url = 'createNewStickerSet'
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
if png_sticker:
@ -1649,6 +1649,8 @@ def create_new_sticker_set(
payload['mask_position'] = mask_position.to_json()
if sticker_type:
payload['sticker_type'] = sticker_type
if needs_repainting is not None:
payload['needs_repainting'] = needs_repainting
return _make_request(token, method_url, params=payload, files=files, method='post')

View File

@ -5455,7 +5455,8 @@ class AsyncTeleBot:
webm_sticker: Union[Any, str]=None,
contains_masks: Optional[bool]=None,
sticker_type: Optional[str]=None,
mask_position: Optional[types.MaskPosition]=None) -> bool:
mask_position: Optional[types.MaskPosition]=None,
needs_repainting: Optional[bool]=None) -> bool:
"""
Use this method to create new sticker set owned by a user.
The bot will be able to edit the created sticker set.
@ -5498,6 +5499,11 @@ class AsyncTeleBot:
:param mask_position: A JSON-serialized object for position where the mask should be placed on faces
:type mask_position: :class:`telebot.types.MaskPosition`
:param needs_repainting: Pass True if stickers in the sticker set must be repainted to the color of text when used in messages,
the accent color if used as emoji status, white on chat photos, or another appropriate color based on context;
for custom emoji sticker sets only
:type needs_repainting: :obj:`bool`
:return: On success, True is returned.
:rtype: :obj:`bool`
"""
@ -5508,7 +5514,7 @@ class AsyncTeleBot:
return await asyncio_helper.create_new_sticker_set(
self.token, user_id, name, title, emojis, png_sticker, tgs_sticker,
mask_position, webm_sticker, sticker_type)
mask_position, webm_sticker, sticker_type, needs_repainting)
async def add_sticker_to_set(

View File

@ -1617,7 +1617,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,
mask_position=None, webm_sticker=None, sticker_type=None):
mask_position=None, webm_sticker=None, sticker_type=None, needs_repainting=None):
method_url = 'createNewStickerSet'
payload = {'user_id': user_id, 'name': name, 'title': title, 'emojis': emojis}
if png_sticker:
@ -1636,6 +1636,8 @@ async def create_new_sticker_set(
payload['mask_position'] = mask_position.to_json()
if sticker_type:
payload['sticker_type'] = sticker_type
if needs_repainting is not None:
payload['needs_repainting'] = needs_repainting
return await _process_request(token, method_url, params=payload, files=files, method='post')