Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @bot.message_handler(func=lambda c: c.startswith("!weather"))
- def weather(message):
- if len(message.text)>9:
- place = message.text[9:]
- observation = owm.weather_at_place(place)
- w = observation.get_weather()
- bot.send_message(message.chat.id, 'in {} is {} fahrenheit and it is {}.'.format(place,str(w.get_temperature('fahrenheit')['temp']),str(w.get_detailed_status()))
- else:
- bot.send_message(message.chat.id, "You must be !weather country/city")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement