Skip to content

Commit

Permalink
Add pass_bot to register_business_message (#2316)
Browse files Browse the repository at this point in the history
* Fix pass_bot in business message handler register
  • Loading branch information
coder2020official authored Jun 22, 2024
1 parent 1f287fa commit ab2dca8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8336,6 +8336,7 @@ def register_business_message_handler(self,
regexp: Optional[str]=None,
func: Optional[Callable]=None,
content_types: Optional[List[str]]=None,
pass_bot: Optional[bool]=False,
**kwargs):
"""
Registers business connection handler.
Expand All @@ -8355,11 +8356,15 @@ def register_business_message_handler(self,
:param content_types: Supported message content types. Must be a list. Defaults to ['text'].
:type content_types: :obj:`list` of :obj:`str`
:param pass_bot: True, if bot instance should be passed to handler
:type pass_bot: :obj:`bool`
:param kwargs: Optional keyword arguments(custom filters)
:return: None
"""
handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func, **kwargs)
handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func,
pass_bot=pass_bot, **kwargs)
self.add_business_message_handler(handler_dict)


Expand Down
7 changes: 6 additions & 1 deletion telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2355,6 +2355,7 @@ def register_business_message_handler(self,
regexp: Optional[str]=None,
func: Optional[Callable]=None,
content_types: Optional[List[str]]=None,
pass_bot: Optional[bool]=False,
**kwargs):
"""
Registers business connection handler.
Expand All @@ -2374,11 +2375,15 @@ def register_business_message_handler(self,
:param content_types: Supported message content types. Must be a list. Defaults to ['text'].
:type content_types: :obj:`list` of :obj:`str`
:param pass_bot: True, if bot instance should be passed to handler
:type pass_bot: :obj:`bool`
:param kwargs: Optional keyword arguments(custom filters)
:return: None
"""
handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func, **kwargs)
handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func,
pass_bot=pass_bot,**kwargs)
self.add_business_message_handler(handler_dict)


Expand Down

0 comments on commit ab2dca8

Please sign in to comment.