Reply in Telegram with the current conditions for whatever place someone names in the chat.
Uses
OpenWeatherMap
Telegram
Look up the weather from Telegram
message.When a new message is received. Save it as message.weatherKeyword to blank.Set weatherKeyword to blank.units to metric.Set units to metric.chatId to message.chat_id.Set chatId to message.chat_id.messageText to blank.Set messageText to blank.noTextErrorIf a step below fails, save the error as noTextErrorTry
message.text and save it as messageText.Trim message.text and save it as messageText.On error
This message carried no text, so there was nothing to look up..Show in the output: This message carried no text, so there was nothing to look up..messageText is emptyIf messageText is emptyYes
No
No steps
messageText by a space and save it as words.Split messageText by a space and save it as words.words[0] lowercase and save it as commandWord.Make words[0] lowercase and save it as commandWord.commandWord is not weatherKeyword in lowercaseIf commandWord is not weatherKeyword in lowercaseYes
No
No steps
words joined by a space and save it as place.Trim the items from index 1 onward of words joined by a space and save it as place.place is empty or the length of place is greater than 60If place is empty or the length of place is greater than 60Yes
chatId.Send a message to chat chatId.Send a place after '@weatherKeyword', for example: weatherKeyword LondonNo
No steps
weather to nothing.Set weather to nothing.lookupFailed to false.Set lookupFailed to false.weatherErrorIf a step below fails, save the error as weatherErrorTry
weather.Get the current weather. Save it as weather.On error
lookupFailed to true.Change lookupFailed to true.lookupFailed is yesIf lookupFailed is yesYes
chatId.Send a message to chat chatId.I could not look up the weather for place. Try adding a country code, like London,GB, or a postal code.place.Finish the run: No weather was found for place.No
No steps
temperatureUnit to K.Set temperatureUnit to K.windUnit to m/s.Set windUnit to m/s.weather.units is metricIf weather.units is metricYes
temperatureUnit to °C.Change temperatureUnit to °C.No
No steps
weather.units is imperialIf weather.units is imperialYes
temperatureUnit to °F.Change temperatureUnit to °F.windUnit to mph.Change windUnit to mph.No
No steps
replyLines to an empty list.Set replyLines to an empty list.heading to place.Set heading to place.weather.location isn't emptyIf weather.location isn't emptyYes
heading to weather.location.Change heading to weather.location.No
No steps
weather.country isn't emptyIf weather.country isn't emptyYes
heading to heading, weather.country.Change heading to heading, weather.country.No
No steps
heading to the end of replyLines and save it as replyLines.Add heading to the end of replyLines and save it as replyLines.weather.conditions isn't emptyIf weather.conditions isn't emptyYes
weather.conditions to the end of replyLines and save it as replyLines.Add Conditions: weather.conditions to the end of replyLines and save it as replyLines.No
No steps
weather.temperature isn't emptyIf weather.temperature isn't emptyYes
weather.temperature formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.Add Temperature: weather.temperature formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.No
No steps
weather.feels_like isn't emptyIf weather.feels_like isn't emptyYes
weather.feels_like formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.Add Feels like: weather.feels_like formatted as a plain number with 1 decimal place@temperatureUnit to the end of replyLines and save it as replyLines.No
No steps
weather.humidity isn't emptyIf weather.humidity isn't emptyYes
weather.humidity formatted as a plain number with 0 decimal places% to the end of replyLines and save it as replyLines.Add Humidity: weather.humidity formatted as a plain number with 0 decimal places% to the end of replyLines and save it as replyLines.No
No steps
weather.wind_speed isn't emptyIf weather.wind_speed isn't emptyYes
weather.wind_speed formatted as a plain number with 1 decimal place@windUnit to the end of replyLines and save it as replyLines.Add Wind: weather.wind_speed formatted as a plain number with 1 decimal place@windUnit to the end of replyLines and save it as replyLines.No
No steps
Current conditions reported by OpenWeatherMap. to the end of replyLines and save it as replyLines.Add Current conditions reported by OpenWeatherMap. to the end of replyLines and save it as replyLines.chatId.Send a message to chat chatId.replyLines joined by a new line