Example messages
- /weather 90210
- /weather Beverley Hills, CA, US
My CommandHandler is as follows:
weather_hanlder = CommandHandler('weather', weather_get_results)
dp.add_handler(weather_handler)
I want everything after /weather to be passed to my weather_get_results(PASS STRING IN HERE) function.
I have looked through telegram’s documentation and examples and haven’t had much luck. Any help would be greatly appreciated. I feel like I’m missing something obvious.
2
Answers
This is probably the wrong way to do this but I managed to find the data in update...
So, the arguments are actually in the context parameter passed to the callback!
context.args specifically; it’s the list of arguments you send through with the command. in your example, context.args[0] would be ‘Beverley’.