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-2/miku/plugins/webshot.lua
Akamaru a3b54cb2a1 Webshot: Nutze jetzt API
tumblr: entferne Shortlink
2017-05-15 16:06:49 +02:00

22 lines
817 B
Lua

local webshot = {}
function webshot:init(config)
webshot.triggers = {
"^/webshot ([%w-_%.%?%.:,/%+=&#!]+)$",
"^/scrot ([%w-_%.%?%.:,/%+=&#!]+)$"
}
webshot.doc = [[*
]]..config.cmd_pat..[[scrot* _<URL>_: Fertigt ein Screenshot mit einer Größe von 1024x768px an.]]
end
function webshot:action(msg, config, matches)
local api_key = cred_data.webshot_key
local cache = '0' --cache=0 : never use cache, always download fresh screenshot || cache=1 : use image from cache only if is not older than 1 day etc...
local url = matches[1]
local img_url = 'http://api.screenshotmachine.com/?key='..api_key..'&dimension=1024x768&cacheLimit='..cache..'&url='..url
utilities.send_typing(msg.chat.id, 'upload_photo')
utilities.send_photo(msg.chat.id, img_url, nil, msg.message_id)
end
return webshot