This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
2016-07-17 13:22:27 +02:00
|
|
|
local venue = {}
|
|
|
|
|
|
|
|
venue.triggers = {
|
|
|
|
'/nil'
|
|
|
|
}
|
|
|
|
|
|
|
|
local apikey = cred_data.google_apikey
|
|
|
|
|
|
|
|
function venue:pre_process(msg, self)
|
2016-08-15 23:14:28 +02:00
|
|
|
if not msg.venue then return msg end -- Ignore
|
2016-07-17 13:22:27 +02:00
|
|
|
|
|
|
|
local lat = msg.venue.location.latitude
|
|
|
|
local lng = msg.venue.location.longitude
|
|
|
|
local url = 'https://maps.googleapis.com/maps/api/geocode/json?latlng='..lat..','..lng..'&result_type=street_address&language=de&key='..apikey
|
|
|
|
local res, code = https.request(url)
|
|
|
|
if code ~= 200 then return msg end
|
|
|
|
local data = json.decode(res).results[1]
|
|
|
|
local city = data.formatted_address
|
|
|
|
utilities.send_reply(self, msg, city)
|
|
|
|
|
|
|
|
return msg
|
|
|
|
end
|
|
|
|
|
|
|
|
function venue:action(msg)
|
|
|
|
end
|
|
|
|
|
2016-08-15 23:14:28 +02:00
|
|
|
return venue
|