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.
Mikubot/plugins/gps.lua

24 lines
782 B
Lua
Raw Normal View History

2014-12-01 17:12:22 +01:00
function run(msg, matches)
local lat = matches[1]
local lon = matches[2]
local receiver = get_receiver(msg)
local zooms = {16, 18}
2015-02-15 16:59:03 +01:00
local urls = {}
2014-12-01 17:12:22 +01:00
for i = 1, #zooms do
local zoom = zooms[i]
local url = "http://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=roadmap&center=" .. lat .. "," .. lon .. "&markers=color:blue%7Clabel:X%7C" .. lat .. "," .. lon
2015-02-15 16:59:03 +01:00
table.insert(urls, url)
2014-12-01 17:12:22 +01:00
end
2015-02-15 16:59:03 +01:00
send_photos_from_url(receiver, urls)
2014-12-01 17:12:22 +01:00
return "www.google.es/maps/place/@" .. lat .. "," .. lon
end
return {
description = "generates a map showing the given GPS coordinates",
2015-02-04 23:03:42 +01:00
usage = "!gps latitude,longitude: generates a map showing the given GPS coordinates",
2014-12-01 17:12:22 +01:00
patterns = {"^!gps ([^,]*)[,%s]([^,]*)$"},
run = run
2015-02-15 16:59:46 +01:00
}