<commit_before>module.exports = (robot) ->

  robot.hear /(.*weather) (.*)/i, (result) ->

    if result.match.length is 0
      city = "Taichung"
    else
      city = result.match[2]
    
    url = "http://api.openweathermap.org/data/2.5/forecast/daily?q="+city+",tw"
    
    robot.http(url)
      .header('Accept', 'application/json')
      .get() (err, res, body) ->
        
        if err
          result.send err.toString()
        else
          data = JSON.parse body
          if data.cod is "200"
            weather = data.city.name+", "+data.city.country+"\n------------\n"
            
            for val in data.list
              d = new Date(val.dt * 1000)
              pad = "00"
              yr = d.getFullYear()
              mt = ""+(d.getMonth()+1)
              dt = ""+d.getDate()
              # pad zero
              mt = pad.substring(0, pad.length - mt.length) + mt
              dt = pad.substring(0, pad.length - dt.length) + dt
              # result
              weather += yr + '-' + mt + '-' + dt + ' ' + val.weather[0].main + '(' + val.weather[0].description + ') ' + val.deg / 10 + '°C\n'
            
            result.send weather
          else
            result.send "GET "+url+"("+data.cod+")\nweather [taiwan city name]"<commit_msg>Fix temperature<commit_after>module.exports = (robot) ->

  robot.hear /(.*weather) (.*)/i, (result) ->

    if result.match.length is 0
      city = "Taichung"
    else
      city = result.match[2]
    
    url = "http://api.openweathermap.org/data/2.5/forecast/daily?q="+city+",tw"
    
    robot.http(url)
      .header('Accept', 'application/json')
      .get() (err, res, body) ->
        
        if err
          result.send err.toString()
        else
          data = JSON.parse body
          if data.cod is "200"
            weather = data.city.name+", "+data.city.country+"\n------------\n"
            
            for val in data.list
              d = new Date(val.dt * 1000)
              pad = "00"
              yr = d.getFullYear()
              mt = ""+(d.getMonth()+1)
              dt = ""+d.getDate()
              # pad zero
              mt = pad.substring(0, pad.length - mt.length) + mt
              dt = pad.substring(0, pad.length - dt.length) + dt
              # result
              weather += yr + '-' + mt + '-' + dt + ' ' + val.weather[0].main + '(' + val.weather[0].description + ') ' + val.temp.day / 10 + '°C\n'
            
            result.send weather
          else
            result.send "GET "+url+"("+data.cod+")\nweather [taiwan city name]"
{'fraction_non_alphanumeric': 0.1713952584531675, 'fraction_numerical': 0.01554605518849592, 'mean_word_length': 1.403361344537815, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2721932', 'n_tokens_mistral': 858, 'n_tokens_neox': 813, 'n_words': 172}