Simplify and use api_key from a config setting.

This commit is contained in:
Marcel van der Boom 2014-11-22 11:59:34 +01:00
parent e19c3adac4
commit edec3178d5

View File

@ -4,9 +4,8 @@
-- 2. Timezone to get the local time in that lat/long location -- 2. Timezone to get the local time in that lat/long location
-- Globals -- Globals
-- If you have a google api key for the geocoding/timezone api, you can fill it in here -- If you have a google api key for the geocoding/timezone api
-- TODO: use bot config file api_key = config.time.api_key or nil
api_key = nil
base_api = "https://maps.googleapis.com/maps/api" base_api = "https://maps.googleapis.com/maps/api"
dateFormat = "%A %d %B - %H:%M:%S" dateFormat = "%A %d %B - %H:%M:%S"
@ -84,9 +83,7 @@ function getformattedLocalTime(area)
end end
local localTime = get_time(lat,lng) local localTime = get_time(lat,lng)
return "The local time in '"..area.. return "The local time in '"..area.."' is: ".. os.date(dateFormat,localTime)
"'\n(Loc: "..lat..", "..lng.." with '"..acc.."' accuracy is:\n" ..
os.date(dateFormat,localTime)
end end
function run(msg, matches) function run(msg, matches)
@ -99,5 +96,3 @@ return {
patterns = {"^!time (.*)$"}, patterns = {"^!time (.*)$"},
run = run run = run
} }