0

I would like ask where the functions like "start" and "help" receive the arguments from? Take a look at this code : https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py

In defining, the parameters, there are 2 arguments "bot" and "update", however, when the functions run in the main method, they do not require passing in arguments. Why is this the case?

Thank you!

Calvin Yee
  • 32
  • 1
  • 5
  • 2
    It looks like the `CommandHandler` accepts those functions as callbacks, and gives them those arguments behind the scenes. Look at the `CommandHelper` constructor. – Carcigenicate Dec 18 '17 at 01:54
  • They are callback functions. They are not running in the main method. They are simply being passed to the library to be called later and the library will pass two arguments, so your function must supply two arguments. – Paul Rooney Dec 18 '17 at 02:21

0 Answers0