mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #197 from aivel/master
+ More flexibility for different handlers(callback_query_handler and etc.)
This commit is contained in:
commit
46fc8da79e
@ -535,9 +535,6 @@ class TeleBot:
|
|||||||
def unban_chat_member(self, chat_id, user_id):
|
def unban_chat_member(self, chat_id, user_id):
|
||||||
return apihelper.unban_chat_member(self.token, chat_id, user_id)
|
return apihelper.unban_chat_member(self.token, chat_id, user_id)
|
||||||
|
|
||||||
def answer_callback_query(self, callback_query_id, text=None, show_alert=None):
|
|
||||||
return apihelper.answer_callback_query(self.token, callback_query_id, text, show_alert)
|
|
||||||
|
|
||||||
def edit_message_text(self, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None,
|
def edit_message_text(self, text, chat_id=None, message_id=None, inline_message_id=None, parse_mode=None,
|
||||||
disable_web_page_preview=None, reply_markup=None):
|
disable_web_page_preview=None, reply_markup=None):
|
||||||
result = apihelper.edit_message_text(self.token, text, chat_id, message_id, inline_message_id, parse_mode,
|
result = apihelper.edit_message_text(self.token, text, chat_id, message_id, inline_message_id, parse_mode,
|
||||||
@ -723,9 +720,9 @@ class TeleBot:
|
|||||||
def add_edited_message_handler(self, handler_dict):
|
def add_edited_message_handler(self, handler_dict):
|
||||||
self.edited_message_handlers.append(handler_dict)
|
self.edited_message_handlers.append(handler_dict)
|
||||||
|
|
||||||
def inline_handler(self, func):
|
def inline_handler(self, func, **kwargs):
|
||||||
def decorator(handler):
|
def decorator(handler):
|
||||||
handler_dict = self._build_handler_dict(handler, func=func)
|
handler_dict = self._build_handler_dict(handler, func=func, **kwargs)
|
||||||
self.add_inline_handler(handler_dict)
|
self.add_inline_handler(handler_dict)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@ -734,9 +731,9 @@ class TeleBot:
|
|||||||
def add_inline_handler(self, handler_dict):
|
def add_inline_handler(self, handler_dict):
|
||||||
self.inline_handlers.append(handler_dict)
|
self.inline_handlers.append(handler_dict)
|
||||||
|
|
||||||
def chosen_inline_handler(self, func):
|
def chosen_inline_handler(self, func, **kwargs):
|
||||||
def decorator(handler):
|
def decorator(handler):
|
||||||
handler_dict = self._build_handler_dict(handler, func=func)
|
handler_dict = self._build_handler_dict(handler, func=func, **kwargs)
|
||||||
self.add_chosen_inline_handler(handler_dict)
|
self.add_chosen_inline_handler(handler_dict)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
@ -745,9 +742,9 @@ class TeleBot:
|
|||||||
def add_chosen_inline_handler(self, handler_dict):
|
def add_chosen_inline_handler(self, handler_dict):
|
||||||
self.chosen_inline_handlers.append(handler_dict)
|
self.chosen_inline_handlers.append(handler_dict)
|
||||||
|
|
||||||
def callback_query_handler(self, func):
|
def callback_query_handler(self, func, **kwargs):
|
||||||
def decorator(handler):
|
def decorator(handler):
|
||||||
handler_dict = self._build_handler_dict(handler, func=func)
|
handler_dict = self._build_handler_dict(handler, func=func, **kwargs)
|
||||||
self.add_callback_query_handler(handler_dict)
|
self.add_callback_query_handler(handler_dict)
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
Loading…
Reference in New Issue
Block a user