gps.lua no delay_s
This commit is contained in:
parent
fbf6c48476
commit
e0dd062cfe
@ -1,25 +1,18 @@
|
|||||||
|
|
||||||
function delay_s(delay)
|
|
||||||
delay = delay or 1
|
|
||||||
local time_to = os.time() + delay
|
|
||||||
while os.time() < time_to do end
|
|
||||||
end
|
|
||||||
|
|
||||||
function run(msg, matches)
|
function run(msg, matches)
|
||||||
local lat = matches[1]
|
local lat = matches[1]
|
||||||
local lon = matches[2]
|
local lon = matches[2]
|
||||||
local receiver = get_receiver(msg)
|
local receiver = get_receiver(msg)
|
||||||
|
|
||||||
local zooms = {16, 18}
|
local zooms = {16, 18}
|
||||||
|
local urls = {}
|
||||||
for i = 1, #zooms do
|
for i = 1, #zooms do
|
||||||
local zoom = zooms[i]
|
local zoom = zooms[i]
|
||||||
local url = "http://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=roadmap¢er=" .. lat .. "," .. lon .. "&markers=color:blue%7Clabel:X%7C" .. lat .. "," .. lon
|
local url = "http://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=roadmap¢er=" .. lat .. "," .. lon .. "&markers=color:blue%7Clabel:X%7C" .. lat .. "," .. lon
|
||||||
local file = download_to_file(url)
|
table.insert(urls, url)
|
||||||
send_photo(receiver, file, ok_cb, false)
|
|
||||||
delay_s(2)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
send_photos_from_url(receiver, urls)
|
||||||
|
|
||||||
return "www.google.es/maps/place/@" .. lat .. "," .. lon
|
return "www.google.es/maps/place/@" .. lat .. "," .. lon
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user