From 54caf30f69bb17b9858b84f015079e6845eb47b6 Mon Sep 17 00:00:00 2001 From: coder2020official Date: Sat, 11 Mar 2023 15:50:09 +0400 Subject: [PATCH] Added the parameter emoji to the method sendSticker to specify an emoji for just uploaded stickers. --- telebot/__init__.py | 8 ++++++-- telebot/apihelper.py | 4 +++- telebot/async_telebot.py | 8 ++++++-- telebot/asyncio_helper.py | 4 +++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index cf79684..047c061 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -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], diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 955b655..3b4f709 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -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') diff --git a/telebot/async_telebot.py b/telebot/async_telebot.py index 14b1f6c..10ef461 100644 --- a/telebot/async_telebot.py +++ b/telebot/async_telebot.py @@ -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], diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index cbf7fdc..f2a9d4b 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -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')