R
R
rgggwwg2021-02-06 10:46:31
Python
rgggwwg, 2021-02-06 10:46:31

PyTelegramBotAPI, how to pass an additional argument to the called function in register_next_step_handler?

When using the register_next_step_handler(message, func) function, how can I pass an additional argument to the called function?

For the func(message) function to accept additional parameters in addition to message. For example func(message, par2, par3)

Only use of global variables came to mind.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-02-06
@rgggwwg

For example func(message, par2, par3)

message = bot.send_message(...)
par2 = 'arg1'
par2 = 'arg2'
bot.register_next_step_handler(message, func, par2, par2)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question