Last edit: @kyork in #marvin-dev 1 year ago - Slack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
if j.main == nil then
  local msg = j.message:gsub("^%l", string.upper) print(j.cod, msg)
return end
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

History

Revision: 2923 by @kyork in #marvin-dev 1 year agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
if j.main == nil then
  local msg = j.message:gsub("^%l", string.upper) print(j.cod, msg)
return end
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 2922 by @kyork in #marvin-dev 1 year agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
if j.main == nil then
  print(j.cod, " ")
  local msg = j.message:gsub("^%l", string.upper) print(msg)
return end
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 2921 by @kyork in #marvin-dev 1 year agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
if j.main == nil then
  print(j.cod, " ")
  print(j.message:gsub("^%l", string.upper))
return end
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 2920 by @kyork in #marvin-dev 1 year agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
if j.main == nil then print(j.marvin_name or j.name) return end
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 2918 by @kyork in #marvin-dev 1 year agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud:",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 786 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.1f °F (%.1f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 785 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. (j.marvin_name or j.name) .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 781 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Conditions: " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 780 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ": " .. symbols[j.weather[1].icon] .. "\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 779 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local symbols ={["01d"]=":sunny:",["01n"]=":new_moon:",["02d"]=":mostly_sunny:",["02n"]=":mostly_sunny:",["03d"]=":barely_sunny:",["03n"]=":barely_sunny:",["04d"]=":cloud:",["04n"]=":cloud",["09d"]=":rain_cloud:",["09n"]=":rain_cloud:",["10d"]=":partly_sunny_rain:",["10n"]=":partly_sunny_rain:",["11d"]=":lightning:",["11n"]=":lightning:",["13d"]=":snow_cloud:",["13n"]=":snow_cloud:",["50d"]=":fog:",["50n"]=":fog:"}
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ": " .. symbols[j.weather[1].id] .. "\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 778 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
-- use the weather_json factoid to handle argument parsing and check for format updates
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 777 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
success, result = pcall(function() return factoid.weather_json(args) end)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 776 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
success, result = pcall(factoid.weather_json, args)
if not success then return "Error: " .. result end
local j = json.load(result)
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 773 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%") end
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 772 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.clouds ~= nil then
 if j.clouds.all > 10 then print("\nCloud cover " .. j.clouds.all .. "%")
end
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 771 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end
if j.snow ~= nil then print("\nSnow last 3hr: " .. j.snow["3h"]) end

Revision: 770 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) end

Revision: 769 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max) .. ".")
if j.rain ~= nil then print("\nRain last 3hr: " .. j.rain["3h"]) en

Revision: 768 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be " .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max))

Revision: 767 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("Current weather for " .. j.name .. ":\n")
print("Today should be .." .. j.weather[1].description.. ". Current temperature: " .. kelvin_to_string(j.main.temp) .. " with a high of " .. kelvin_to_string(j.main.temp_max))

Revision: 766 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return string.format("%.2f °F (%.2f °C)", t.f, t.c)
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("weather for " .. j.name .. " .. ")
print("today should be .." .. j.weather[1].description.. ".. current temperature " .. kelvin_to_string(j.main.temp) .. " .. high of " .. kelvin_to_string(j.main.temp_max))

Revision: 765 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k - 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return t.f .. "°F (" .. t.c .. "°C)"
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("weather for " .. j.name .. " .. ")
print("today should be .." .. j.weather[1].description.. ".. current temperature " .. kelvin_to_string(j.main.temp) .. " .. high of " .. kelvin_to_string(j.main.temp_max))

Revision: 764 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k + 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return t.f .. "°F (" .. t.c .. "°C)"
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("weather for " .. j.name .. " .. ")
print("today should be .." .. j.weather[1].description.. ".. current temperature " .. kelvin_to_string(j.main.temp) .. " .. high of " .. kelvin_to_string(j.main.temp_max))

Revision: 763 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k + 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return t.f .. "°F (" .. t.c .. "°C)"
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("weather for " .. j.name .. " .. ")
print("today should be .." .. j.weather[1].description.. ".. current temperature " .. temp_to_string(j.main.temp) .. " .. high of " .. temp_to_string(j.main.temp_max))

Revision: 762 by @kyork in #marvin-dev 2 years agoSlack Archive

{lua} function temp_kelvin(k)
 local c = k + 273.15
 local f = c * 9 / 5 + 32
 return {k=k, c=c, f=f}
end
function kelvin_to_string(k)
 local t = temp_kelvin(k)
 return t.f .. "°F (" .. t.c .. "°C)"
end
local query = args
if query == "" then query = "Ardenwood,Fremont" end
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
print("today should be .." .. j.weather[1].description.. ".. current temperature " .. temp_to_string(j.main.temp) .. " .. high of " .. temp_to_string(j.main.temp_max))
if j.url ~= nil then print(j.url)
else print("No results") end

Revision: 761 by @egreen in #marvin-dev 2 years agoSlack Archive

{lua} local query = args
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if query == "" then query = "Fremont" end
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
if j.url ~= nil then print(j.url)
else print("No results") end

Revision: 760 by @egreen in #marvin-dev 2 years agoSlack Archive

{lua} local query = args
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if query == "" then query = "Fremont" end
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
if j.data.url ~= nil then print(j.data.url)
else print("No results") end

Revision: 759 by @egreen in #marvin-dev 2 years agoSlack Archive

{lua} local query = "%args%"
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if query == "" then query = "Fremont" end
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
if j.weather.url ~= nil then print(j.weather.url)
else print("No results") end

Revision: 756 by @egreen in #marvin-dev 2 years agoSlack Archive

{lua} local query = args
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={" .. bot.uriencode(query).. "}&APPID=e64a1c841d59ea94cfe01208b91ea7dc")
if query == "" then query = "Fremont" end
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
if j.weather.url ~= nil then print(j.weather.url)
else print("No results") end

Revision: 670 by @crenfrow in #marvin-dev 2 years agoSlack Archive

{lua} local query = argv[1]
local resp, err = requests.get("http://api.openweathermap.org/data/2.5/weather?q={Fremont}&APPID=e64a1c841d59ea94cfe01208b91ea7dc" .. bot.uriencode(query))
if err ~= nil then print("Error: " .. err) return end
local j = resp:json()
if j.data.url ~= nil then print(j.data.url)
else print("No results") end

Revision: 669 by @egreen in #marvin-dev 2 years agoSlack Archive

http://api.openweathermap.org/data/2.5/weather?q={Fremont}&APPID=e64a1c841d59ea94cfe01208b91ea7dc

Revision: 636 by @egreen in #marvin-dev 2 years agoSlack Archive

Revision: 635 by @egreen in #marvin-dev 2 years agoSlack Archive

Revision: 634 by @egreen in #marvin-dev 2 years agoSlack Archive

Revision: 628 by @egreen in #random 2 years agoSlack Archive

https://weather.com/weather/today/l/94538:4:US