From ae6e7ada84d946e8840a459e86d8e51560f5c123 Mon Sep 17 00:00:00 2001 From: Ranjit <111440072+ranjitsingha@users.noreply.github.com> Date: Tue, 10 Feb 2026 08:24:15 +0530 Subject: [PATCH 1/7] Add style and icon_custom_emoji_id to InlineKeyboardButton and KeyboardButton Add style and icon_custom_emoji_id to InlineKeyboardButton and KeyboardButton --- telebot/types.py | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 73dba2015..0e0e7417f 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -2928,6 +2928,13 @@ class KeyboardButton(Dictionaryable, JsonSerializable): :param request_chat: Optional. If specified, pressing the button will open a list of suitable chats. Tapping on a chat will send its identifier to the bot in a “chat_shared” service message. Available in private chats only. :type request_chat: :class:`telebot.types.KeyboardButtonRequestChat` + + :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. + Can only be used if the bot has a Telegram Premium subscription. + :type icon_custom_emoji_id: :obj:`str` + + :param style: Optional. Style of the button. Can be used to change the color of the button. + :type style: :obj:`str` :return: Instance of the class :rtype: :class:`telebot.types.KeyboardButton` @@ -2935,7 +2942,8 @@ class KeyboardButton(Dictionaryable, JsonSerializable): def __init__(self, text: str, request_contact: Optional[bool]=None, request_location: Optional[bool]=None, request_poll: Optional[KeyboardButtonPollType]=None, web_app: Optional[WebAppInfo]=None, request_user: Optional[KeyboardButtonRequestUser]=None, - request_chat: Optional[KeyboardButtonRequestChat]=None, request_users: Optional[KeyboardButtonRequestUsers]=None): + request_chat: Optional[KeyboardButtonRequestChat]=None, request_users: Optional[KeyboardButtonRequestUsers]=None, + icon_custom_emoji_id: Optional[str]=None, style: Optional[str]=None): self.text: str = text self.request_contact: Optional[bool] = request_contact self.request_location: Optional[bool] = request_location @@ -2943,6 +2951,8 @@ def __init__(self, text: str, request_contact: Optional[bool]=None, self.web_app: Optional[WebAppInfo] = web_app self.request_chat: Optional[KeyboardButtonRequestChat] = request_chat self.request_users: Optional[KeyboardButtonRequestUsers] = request_users + self.icon_custom_emoji_id: Optional[str] = icon_custom_emoji_id + self.style: Optional[str] = style if request_user is not None: log_deprecation_warning('The parameter "request_user" is deprecated, use "request_users" instead') if self.request_users is None: @@ -2967,6 +2977,10 @@ def to_dict(self): json_dict['request_users'] = self.request_users.to_dict() if self.request_chat is not None: json_dict['request_chat'] = self.request_chat.to_dict() + if self.icon_custom_emoji_id is not None: + json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id + if self.style is not None: + json_dict['style'] = self.style return json_dict @@ -3133,6 +3147,13 @@ class InlineKeyboardButton(Dictionaryable, JsonSerializable, JsonDeserializable) :param copy_text: Optional. Description of the button that copies the specified text to the clipboard. :type copy_text: :class:`telebot.types.CopyTextButton` + + :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. + Can only be used if the bot has a Telegram Premium subscription. + :type icon_custom_emoji_id: :obj:`str` + + :param style: Optional. Style of the button. Can be used to change the color of the button. + :type style: :obj:`str` :return: Instance of the class :rtype: :class:`telebot.types.InlineKeyboardButton` @@ -3155,7 +3176,7 @@ def de_json(cls, json_string): def __init__(self, text: str, url: Optional[str]=None, callback_data: Optional[str]=None, web_app: Optional[WebAppInfo]=None, switch_inline_query: Optional[str]=None, switch_inline_query_current_chat: Optional[str]=None, switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat]=None, callback_game=None, pay: Optional[bool]=None, - login_url: Optional[LoginUrl]=None, copy_text: Optional[CopyTextButton]=None, **kwargs): + login_url: Optional[LoginUrl]=None, copy_text: Optional[CopyTextButton]=None, icon_custom_emoji_id: Optional[str] = None, style: Optional[str] = None, **kwargs): self.text: str = text self.url: Optional[str] = url self.callback_data: Optional[str] = callback_data @@ -3167,6 +3188,8 @@ def __init__(self, text: str, url: Optional[str]=None, callback_data: Optional[s self.pay: Optional[bool] = pay self.login_url: Optional[LoginUrl] = login_url self.copy_text: Optional[CopyTextButton] = copy_text + self.icon_custom_emoji_id = icon_custom_emoji_id + self.style = style def to_json(self): return json.dumps(self.to_dict()) @@ -3193,6 +3216,10 @@ def to_dict(self): json_dict['switch_inline_query_chosen_chat'] = self.switch_inline_query_chosen_chat.to_dict() if self.copy_text is not None: json_dict['copy_text'] = self.copy_text.to_dict() + if self.icon_custom_emoji_id is not None: + json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id + if self.style is not None: + json_dict['style'] = self.style return json_dict From 23e8ab88c5e90dbc52523f3121ea7968e76a1e25 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Tue, 10 Feb 2026 10:11:24 +0300 Subject: [PATCH 2/7] Fix spaces Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- telebot/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index 0e0e7417f..30eff32fb 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -3219,7 +3219,7 @@ def to_dict(self): if self.icon_custom_emoji_id is not None: json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id if self.style is not None: - json_dict['style'] = self.style + json_dict['style'] = self.style return json_dict From 13f771b2659e1415dd3329a46f4ca079a7cdc4bd Mon Sep 17 00:00:00 2001 From: Badiboy Date: Tue, 10 Feb 2026 10:13:16 +0300 Subject: [PATCH 3/7] Fix spaces Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- telebot/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index 30eff32fb..f61114e86 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -2929,7 +2929,7 @@ class KeyboardButton(Dictionaryable, JsonSerializable): send its identifier to the bot in a “chat_shared” service message. Available in private chats only. :type request_chat: :class:`telebot.types.KeyboardButtonRequestChat` - :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. + :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. Can only be used if the bot has a Telegram Premium subscription. :type icon_custom_emoji_id: :obj:`str` From a75af38566074e388d28c45b9906daa8ff2e9e43 Mon Sep 17 00:00:00 2001 From: Badiboy Date: Tue, 10 Feb 2026 10:13:27 +0300 Subject: [PATCH 4/7] Fix spaces Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- telebot/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/types.py b/telebot/types.py index f61114e86..82073d9be 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -2980,7 +2980,7 @@ def to_dict(self): if self.icon_custom_emoji_id is not None: json_dict['icon_custom_emoji_id'] = self.icon_custom_emoji_id if self.style is not None: - json_dict['style'] = self.style + json_dict['style'] = self.style return json_dict From 337978a159035da0e48c0ab93ce69c8e3a4c05b8 Mon Sep 17 00:00:00 2001 From: Ranjit <111440072+ranjitsingha@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:20:51 +0530 Subject: [PATCH 5/7] Fix formatting of constructor parameters in types.py --- telebot/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 82073d9be..1f96ec2ec 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -3176,7 +3176,7 @@ def de_json(cls, json_string): def __init__(self, text: str, url: Optional[str]=None, callback_data: Optional[str]=None, web_app: Optional[WebAppInfo]=None, switch_inline_query: Optional[str]=None, switch_inline_query_current_chat: Optional[str]=None, switch_inline_query_chosen_chat: Optional[SwitchInlineQueryChosenChat]=None, callback_game=None, pay: Optional[bool]=None, - login_url: Optional[LoginUrl]=None, copy_text: Optional[CopyTextButton]=None, icon_custom_emoji_id: Optional[str] = None, style: Optional[str] = None, **kwargs): + login_url: Optional[LoginUrl]=None, copy_text: Optional[CopyTextButton]=None, icon_custom_emoji_id: Optional[str]=None, style: Optional[str]=None, **kwargs): self.text: str = text self.url: Optional[str] = url self.callback_data: Optional[str] = callback_data @@ -13495,4 +13495,4 @@ def de_json(cls, json_string): obj = cls.check_json(json_string) return cls(**obj) - \ No newline at end of file + From 196bcb455603c867338fe9bd76ee8642e444a91d Mon Sep 17 00:00:00 2001 From: Ranjit <111440072+ranjitsingha@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:26:13 +0530 Subject: [PATCH 6/7] Add type hints for icon_custom_emoji_id and style --- telebot/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 1f96ec2ec..90af87244 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -3188,8 +3188,8 @@ def __init__(self, text: str, url: Optional[str]=None, callback_data: Optional[s self.pay: Optional[bool] = pay self.login_url: Optional[LoginUrl] = login_url self.copy_text: Optional[CopyTextButton] = copy_text - self.icon_custom_emoji_id = icon_custom_emoji_id - self.style = style + self.icon_custom_emoji_id: Optional[str] = icon_custom_emoji_id + self.style: Optional[str] = style def to_json(self): return json.dumps(self.to_dict()) From 015da7cbc6961281dbdb3197c1660ea9a71e8715 Mon Sep 17 00:00:00 2001 From: Ranjit <111440072+ranjitsingha@users.noreply.github.com> Date: Tue, 10 Feb 2026 13:37:04 +0530 Subject: [PATCH 7/7] Update icon_custom_emoji_id parameter description Clarified the requirement for Telegram Premium subscription in the icon_custom_emoji_id parameter. --- telebot/types.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/telebot/types.py b/telebot/types.py index 90af87244..3f5f683ad 100644 --- a/telebot/types.py +++ b/telebot/types.py @@ -3148,8 +3148,7 @@ class InlineKeyboardButton(Dictionaryable, JsonSerializable, JsonDeserializable) :param copy_text: Optional. Description of the button that copies the specified text to the clipboard. :type copy_text: :class:`telebot.types.CopyTextButton` - :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. - Can only be used if the bot has a Telegram Premium subscription. + :param icon_custom_emoji_id: Optional. Custom emoji identifier to be shown on the button. Can only be used if the bot owner has a Telegram Premium subscription. :type icon_custom_emoji_id: :obj:`str` :param style: Optional. Style of the button. Can be used to change the color of the button.