22 lines
817 B
Lua
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 |