local figuya = {} function figuya:init(config) figuya.triggers = {'figuya.com/de/produkte/(.+)$'} end function figuya:get_figuya(figu) local api_key = cred_data.iframely_api_key local url = 'http://iframe.ly/api/oembed?url=https%3A%2F%2Ffiguya.com%2Fde%2Fprodukte%2F'..figu..'&api_key='..api_key local b,c = https.request(url) if c ~= 200 then return nil end local data = json.decode(b) local title = '*'..data.title..'*' local desc = '\n'..unescape(data.description) local pic = data.thumbnail_url local text = title..desc if string.len(text) > 200 then text = string.sub(unescape(text:gsub("%b<>", "")), 1, 197)..'...' else text = text end return text, pic end function figuya:action(msg, config, matches) local figu = matches[1] local text, pic = figuya:get_figuya(figu) if not text then utilities.send_reply(msg, config.errors.results) return end utilities.send_typing(receiver, 'upload_photo') utilities.send_photo(msg.chat.id, pic, text) end return figuya