MCPcopy Create free account
hub / github.com/eternnoir/pyTelegramBotAPI / register_for_reply_by_message_id

Method register_for_reply_by_message_id

telebot/__init__.py:8508–8527  ·  view source on GitHub ↗

Registers a callback function to be notified when a reply to `message` arrives. Warning: In case `callback` as lambda function, saving reply handlers will not work. :param message_id: The id of the message for which we are awaiting a reply. :type message_id: :obj:`

(
            self, message_id: int, callback: Callable, *args, **kwargs)

Source from the content-addressed store, hash-verified

8506
8507
8508 def register_for_reply_by_message_id(
8509 self, message_id: int, callback: Callable, *args, **kwargs) -> None:
8510 """
8511 Registers a callback function to be notified when a reply to `message` arrives.
8512
8513 Warning: In case `callback` as lambda function, saving reply handlers will not work.
8514
8515 :param message_id: The id of the message for which we are awaiting a reply.
8516 :type message_id: :obj:`int`
8517
8518 :param callback: The callback function to be called when a reply arrives. Must accept one `message`
8519 parameter, which will contain the replied message.
8520 :type callback: :obj:`Callable[[telebot.types.Message], None]`
8521
8522 :param args: Optional arguments for the callback function.
8523 :param kwargs: Optional keyword arguments for the callback function.
8524
8525 :return: None
8526 """
8527 self.reply_backend.register_handler(message_id, Handler(callback, *args, **kwargs))
8528
8529
8530 def _notify_reply_handlers(self, new_messages) -> None:

Callers 2

register_for_replyMethod · 0.95
startFunction · 0.80

Calls 2

HandlerClass · 0.70
register_handlerMethod · 0.45

Tested by 1

startFunction · 0.64