no delay_s on location.lua 💥

This commit is contained in:
yago 2015-02-15 16:54:03 +01:00
parent b391bb26d2
commit fbf6c48476

View File

@ -12,12 +12,6 @@ api_key = nil
base_api = "https://maps.googleapis.com/maps/api" base_api = "https://maps.googleapis.com/maps/api"
function delay_s(delay)
delay = delay or 1
local time_to = os.time() + delay
while os.time() < time_to do end
end
function get_staticmap(area) function get_staticmap(area)
local api = base_api .. "/staticmap?" local api = base_api .. "/staticmap?"
@ -46,17 +40,11 @@ function run(msg, matches)
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
local lat,lng,url = get_staticmap(matches[1]) local lat,lng,url = get_staticmap(matches[1])
local file_path = download_to_file(url)
-- Send the actual location, is a google maps link -- Send the actual location, is a google maps link
send_location(receiver, lat, lng, ok_cb, false) send_location(receiver, lat, lng, ok_cb, false)
-- Send a picture of the map, which takes scale into account -- Send a picture of the map, which takes scale into account
send_photo(receiver, file_path, ok_cb, false) send_photo_from_url(receiver, url)
delay_s(2)
-- Clean up after some time
postpone(rmtmp_cb, file_path, 20.0)
-- Return a link to the google maps stuff is now not needed anymore -- Return a link to the google maps stuff is now not needed anymore
return nil return nil