Added the parameter emoji to the method sendSticker to specify an emoji for just uploaded stickers.

This commit is contained in:
coder2020official 2023-03-11 15:50:09 +04:00
parent 09e4a2a437
commit 54caf30f69
4 changed files with 18 additions and 6 deletions

View File

@ -2099,7 +2099,8 @@ class TeleBot:
allow_sending_without_reply: Optional[bool]=None,
protect_content:Optional[bool]=None,
data: Union[Any, str]=None,
message_thread_id: Optional[int]=None) -> types.Message:
message_thread_id: Optional[int]=None,
emoji: Optional[str]=None) -> types.Message:
"""
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
On success, the sent Message is returned.
@ -2139,6 +2140,9 @@ class TeleBot:
:param message_thread_id: The thread to which the message will be sent
:type message_thread_id: :obj:`int`
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
:type emoji: :obj:`str`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@ -2156,7 +2160,7 @@ class TeleBot:
reply_to_message_id=reply_to_message_id, reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout,
allow_sending_without_reply=allow_sending_without_reply,
protect_content=protect_content, message_thread_id=message_thread_id))
protect_content=protect_content, message_thread_id=message_thread_id, emoji=emoji))
def send_video(
self, chat_id: Union[int, str], video: Union[Any, str],

View File

@ -896,7 +896,7 @@ def send_audio(token, chat_id, audio, caption=None, duration=None, performer=Non
def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None,
disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None,
allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None,
protect_content = None, message_thread_id=None):
protect_content = None, message_thread_id=None, emoji=None):
method_url = get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
@ -937,6 +937,8 @@ def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_m
payload['disable_content_type_detection'] = disable_content_type_detection
if message_thread_id:
payload['message_thread_id'] = message_thread_id
if emoji:
payload['emoji'] = emoji
return _make_request(token, method_url, params=payload, files=files, method='post')

View File

@ -2958,7 +2958,8 @@ class AsyncTeleBot:
allow_sending_without_reply: Optional[bool]=None,
protect_content: Optional[bool]=None,
data: Union[Any, str]=None,
message_thread_id: Optional[int]=None) -> types.Message:
message_thread_id: Optional[int]=None,
emoji: Optional[str]=None) -> types.Message:
"""
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
On success, the sent Message is returned.
@ -2998,6 +2999,9 @@ class AsyncTeleBot:
:param message_thread_id: Identifier of a message thread, in which the message will be sent
:type message_thread_id: :obj:`int`
:param emoji: Emoji associated with the sticker; only for just uploaded stickers
:type emoji: :obj:`str`
:return: On success, the sent Message is returned.
:rtype: :class:`telebot.types.Message`
"""
@ -3016,7 +3020,7 @@ class AsyncTeleBot:
reply_to_message_id=reply_to_message_id, reply_markup=reply_markup,
disable_notification=disable_notification, timeout=timeout,
allow_sending_without_reply=allow_sending_without_reply, protect_content=protect_content,
message_thread_id=message_thread_id))
message_thread_id=message_thread_id, emoji=emoji))
async def send_video(
self, chat_id: Union[int, str], video: Union[Any, str],

View File

@ -888,7 +888,7 @@ async def send_audio(token, chat_id, audio, caption=None, duration=None, perform
async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, reply_markup=None, parse_mode=None,
disable_notification=None, timeout=None, caption=None, thumb=None, caption_entities=None,
allow_sending_without_reply=None, disable_content_type_detection=None, visible_file_name=None, protect_content=None,
message_thread_id=None):
message_thread_id=None, emoji=None):
method_url = await get_method_by_type(data_type)
payload = {'chat_id': chat_id}
files = None
@ -929,6 +929,8 @@ async def send_data(token, chat_id, data, data_type, reply_to_message_id=None, r
payload['disable_content_type_detection'] = disable_content_type_detection
if message_thread_id:
payload['message_thread_id'] = message_thread_id
if emoji:
payload['emoji'] = emoji
return await _process_request(token, method_url, params=payload, files=files, method='post')