diff --git a/scripts/meteo.coffee b/scripts/meteo.coffee index 34e52b3..a2a2637 100644 --- a/scripts/meteo.coffee +++ b/scripts/meteo.coffee @@ -16,7 +16,7 @@ moment = require 'moment' -regex = /(?:(?:d(?:a|i)mmi il )?meteo(?: per (.+))?|che tempo (?:fa|c'è)(?: (?:a|in) (.+))?)\??$/i +regex = /(?:(?:(?:mi (?:dici|dai)|dammi) (?:il (?:tempo|meteo)|(?:le previsioni)))(?: ?(?:(?:per ?(?:(?:l')|il |lo |la |i |gli |le )?)|di |a ))?|(?:che tempo (?:fa|(?:c'?(?:è|e|e')))(?: ?(?:in|a) )?))([^?!]+)?.*$/i url1 = 'http://ip-api.com/json/' url2 = 'http://api.openweathermap.org/data/2.5/weather?lang=it&units=metric' @@ -64,7 +64,7 @@ module.exports = (robot) -> tramonto alle #{dusk}" robot.respond regex, (res) -> - city = res.match[1] || res.match[2] + city = res.match[1] if city? get_weather city, send_weather res else