32 lines
814 B
Lua
32 lines
814 B
Lua
|
local pornhub = {}
|
||
|
|
||
|
function pornhub:init(config)
|
||
|
pornhub.triggers = {
|
||
|
"pornhub.com/gif/(.+)$",
|
||
|
"^/phg (.+)$",
|
||
|
"^/porngif (.+)$"
|
||
|
}
|
||
|
pornhub.doc = [[*
|
||
|
]]..config.cmd_pat..[[phg* _<ID>_: Sendet GIF von PornHub (NSFW)]]
|
||
|
end
|
||
|
|
||
|
pornhub.command = 'ge <ID>'
|
||
|
|
||
|
function pornhub:action(msg, config, matches)
|
||
|
local url = 'http://img.pornhub.com/gif/'..matches[1]..'.gif'
|
||
|
utilities.send_typing(self, msg.chat.id, 'upload_document')
|
||
|
local file = download_to_file(url)
|
||
|
if not file then
|
||
|
utilities.send_reply(self, msg, config.errors.results)
|
||
|
return
|
||
|
end
|
||
|
|
||
|
if string.starts(msg.text_lower, '/phg') or string.starts(msg.text_lower, '/porngif') then
|
||
|
source = 'http://www.pornhub.com/gif/'..matches[1]
|
||
|
else
|
||
|
source = nil
|
||
|
end
|
||
|
utilities.send_document(self, msg.chat.id, file, source)
|
||
|
end
|
||
|
|
||
|
return pornhub
|