Skip to content

Commit 909d570

Browse files
committed
Add warning about lambda functions in callbacks
1 parent 424c77f commit 909d570

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎telebot/__init__.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,8 @@ def register_for_reply(self, message, callback, *args, **kwargs):
11721172
Warning: `message` must be sent with reply_markup=types.ForceReply(), otherwise TeleBot will not be able to see
11731173
the difference between a reply to `message` and an ordinary message.
11741174
1175+
Warning: In case `callback` as lambda function, saving reply handlers will not work.
1176+
11751177
:param message: The message for which we are awaiting a reply.
11761178
:param callback: The callback function to be called when a reply arrives. Must accept one `message`
11771179
parameter, which will contain the replied message.
@@ -1186,6 +1188,8 @@ def register_for_reply_by_message_id(self, message_id, callback, *args, **kwargs
11861188
Warning: `message` must be sent with reply_markup=types.ForceReply(), otherwise TeleBot will not be able to see
11871189
the difference between a reply to `message` and an ordinary message.
11881190
1191+
Warning: In case `callback` as lambda function, saving reply handlers will not work.
1192+
11891193
:param message: The message for which we are awaiting a reply.
11901194
:param callback: The callback function to be called when a reply arrives. Must accept one `message`
11911195
parameter, which will contain the replied message.
@@ -1213,6 +1217,8 @@ def register_next_step_handler(self, message, callback, *args, **kwargs):
12131217
"""
12141218
Registers a callback function to be notified when new message arrives after `message`.
12151219
1220+
Warning: In case `callback` as lambda function, saving next step handlers will not work.
1221+
12161222
:param message: The message for which we want to handle new message in the same chat.
12171223
:param callback: The callback function which next new message arrives.
12181224
:param args: Args to pass in callback func
@@ -1225,6 +1231,8 @@ def register_next_step_handler_by_chat_id(self, chat_id, callback, *args, **kwar
12251231
"""
12261232
Registers a callback function to be notified when new message arrives after `message`.
12271233
1234+
Warning: In case `callback` as lambda function, saving next step handlers will not work.
1235+
12281236
:param chat_id: The chat for which we want to handle new message.
12291237
:param callback: The callback function which next new message arrives.
12301238
:param args: Args to pass in callback func

0 commit comments

Comments
 (0)