Entferne download_to_file aus paar Plugins

Kleinere Fixes
This commit is contained in:
Akamaru 2016-11-29 18:14:26 +01:00
parent 69a3bae9db
commit 201346955c
8 changed files with 63 additions and 28 deletions

View File

@ -44,11 +44,10 @@ function cf_img:action(msg, config, matches)
end end
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local file = download_to_file(full_url)
if string.ends(full_url, '.gif') then if string.ends(full_url, '.gif') then
utilities.send_document(msg.chat.id, file, nil, msg.message_id) utilities.send_document(msg.chat.id, full_url, nil, msg.message_id)
else else
utilities.send_photo(msg.chat.id, file, nil, msg.message_id) utilities.send_photo(msg.chat.id, full_url, nil, msg.message_id)
end end
end end

View File

@ -19,12 +19,11 @@ function dogify:action(msg, config, matches)
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local path = input:gsub(" ", "%%20") local path = input:gsub(" ", "%%20")
local photo_url = 'http://dogr.io/'..path..'.png?split=false&.png' local photo_url = 'http://dogr.io/'..path..'.png?split=false&.png'
local file = download_to_file(photo_url) if not photo_url then
if not file then
utilities.send_reply(msg, config.errors.connection) utilities.send_reply(msg, config.errors.connection)
return return
end end
utilities.send_photo(msg.chat.id, file, nil, msg.message_id) utilities.send_photo(msg.chat.id, photo_url, nil, msg.message_id)
end end
return dogify return dogify

View File

@ -19,7 +19,7 @@ function jk:action(msg, config)
} }
local random_pic = math.random(#jk_pics) local random_pic = math.random(#jk_pics)
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local file = download_to_file(JK_URL..jk_pics[random_pic]) local file = JK_URL..jk_pics[random_pic]
utilities.send_photo(msg.chat.id, file) utilities.send_photo(msg.chat.id, file)
end end

View File

@ -29,7 +29,7 @@ function play_store:send_playstore_data(data)
local category = data.category.name local category = data.category.name
local rating = data.rating.average local rating = data.rating.average
local installs = data.performance.installs local installs = data.performance.installs
local description = data.description local description = unescape(data.description)
if data.version == "Varies with device" then if data.version == "Varies with device" then
appversion = "variiert je nach Gerät" appversion = "variiert je nach Gerät"
else else

View File

@ -20,6 +20,9 @@ special.triggers = {
"^[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]$", "^[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]$",
"^[Aa][Hh][Aa].[Pp][Nn][Gg]$", "^[Aa][Hh][Aa].[Pp][Nn][Gg]$",
"^~?[Pp][Oo][Ii]$", "^~?[Pp][Oo][Ii]$",
"[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee] [Gg][Ll][Ii][Tt][Cc][Hh]",
"[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee]",
"^[Nn][Aa][Nn][Oo] [Hh][Aa][Kk][Aa][Ss][Ee]$",
"^/[Tt][Hh][Yy][Mm][Ee]$", "^/[Tt][Hh][Yy][Mm][Ee]$",
"^[Yy][Oo][Ll][Oo]$", "^[Yy][Oo][Ll][Oo]$",
"[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]", "[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]",
@ -52,13 +55,13 @@ function special:action(msg, config, matches)
elseif msg_text:match("/[Oo][Ll][Dd]") then elseif msg_text:match("/[Oo][Ll][Dd]") then
output = 'Deine Mudda is old!' output = 'Deine Mudda is old!'
elseif msg_text:match("[Nn][Yy][Uu]") then elseif msg_text:match("[Nn][Yy][Uu]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/JSXH/nyu.jpg'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/JSXH/nyu.jpg', nil, msg.message_id)
return return
elseif msg_text:match("[Nn][Ii][Ii][Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ii](-)[Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ss][Ss][Aa][Nn]") then elseif msg_text:match("[Nn][Ii][Ii][Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ii](-)[Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ss][Ss][Aa][Nn]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/XB2T/Nii-san.jpg'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/XB2T/Nii-san.jpg', nil, msg.message_id)
return return
elseif msg_text:match("/[Nn][Ee][Oo][Rr][Aa][Mm][Ee]") then elseif msg_text:match("/[Nn][Ee][Oo][Rr][Aa][Mm][Ee]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/GM93/neorame.jpg'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/GM93/neorame.jpg', nil, msg.message_id)
return return
elseif msg_text:match("[Ff][Tt][Tt]") then elseif msg_text:match("[Ff][Tt][Tt]") then
output = [[(°°) FLIP THAT TABLE. output = [[(°°) FLIP THAT TABLE.
@ -83,23 +86,32 @@ function special:action(msg, config, matches)
elseif msg_text:match("^[Mm]ö[Pp]?$") or msg_text:match("[Mm][Ee][Ee][Pp]") then elseif msg_text:match("^[Mm]ö[Pp]?$") or msg_text:match("[Mm][Ee][Ee][Pp]") then
output = 'se' output = 'se'
elseif msg_text:match("[Bb][Aa][Rr][Uu][Ss][Aa][Mm][Ii][Kk][Oo][Ss][Uu]") or msg_text:match("[Bb][Aa][Ll][Ss][Aa][Mm][Ii][Kk][Oo] [Ee][Ss][Ss][Ii][Gg]") then elseif msg_text:match("[Bb][Aa][Rr][Uu][Ss][Aa][Mm][Ii][Kk][Oo][Ss][Uu]") or msg_text:match("[Bb][Aa][Ll][Ss][Aa][Mm][Ii][Kk][Oo] [Ee][Ss][Ss][Ii][Gg]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/0SEY/barusamikosu.jpg'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/0SEY/barusamikosu.jpg', nil, msg.message_id)
return return
elseif msg_text:match("[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]") then elseif msg_text:match("[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]") then
output = 'Gomen\'nasai '..msg.from.first_name..'-senpai 😣' output = 'Gomen\'nasai '..msg.from.first_name..'-senpai 😣'
elseif msg_text:match("[Aa][Hh][Aa].[Pp][Nn][Gg]") then elseif msg_text:match("[Aa][Hh][Aa].[Pp][Nn][Gg]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/W97R/aha.png'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/W97R/aha.png', nil, msg.message_id)
return return
elseif msg_text:match("[Pp][Oo][Ii]") then elseif msg_text:match("[Pp][Oo][Ii]") then
utilities.send_document(msg.chat.id, download_to_file('https://dl.dropboxusercontent.com/u/32829149/poi.webp'), nil, msg.message_id) utilities.send_document(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/poi.webp', nil, msg.message_id)
return
elseif msg_text:match("[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee] [Gg][Ll][Ii][Tt][Cc][Hh]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/YOSHI_DANCE_GLITCH.mp4', nil, msg.message_id)
return
elseif msg_text:match("[Yy][Oo][Ss][Hh][Ii] [Dd][Aa][Nn][Cc][Ee]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/YOSHI_DANCE.mp4', 'YOSHI DANCE!', msg.message_id)
return
elseif msg_text:match("[Nn][Aa][Nn][Oo] [Hh][Aa][Kk][Aa][Ss][Ee]") then
utilities.send_video(msg.chat.id, 'http://code.ponywave.de/workspace/test/fuck/nano-hakase-1.mp4', 'NANO! NANO! NANO! NANO! NANO! NANO!\nHAKASE! HAKASE! HAKASE! HAKASE! HAKASE! HAKASE!', msg.message_id)
return return
elseif msg_text:match("/[Tt][Hh][Yy][Mm][Ee]") then elseif msg_text:match("/[Tt][Hh][Yy][Mm][Ee]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/N6NO/thyme.jpg'), nil, msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/N6NO/thyme.jpg', 'What thyme is it?', msg.message_id)
return return
elseif msg_text:match("[Yy][Oo][Ll][Oo]") then elseif msg_text:match("[Yy][Oo][Ll][Oo]") then
output = 'Hä YOLO?' output = 'Hä YOLO?'
elseif msg_text:match("[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]") then elseif msg_text:match("[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/N03B/squid.jpg'), 'They are', msg.message_id) utilities.send_photo(msg.chat.id, 'http://img.ponywave.de/di/N03B/squid.jpg', 'They are', msg.message_id)
return return
elseif msg_text:match("[Kk][Ii][Ll][Ll]") then elseif msg_text:match("[Kk][Ii][Ll][Ll]") then
output = user_name..' tötet '..matches[1] output = user_name..' tötet '..matches[1]

View File

@ -13,13 +13,14 @@ function speedtest_cli:action(msg, config)
utilities.send_typing(msg.chat.id, 'typing') utilities.send_typing(msg.chat.id, 'typing')
local result = run_command('speedtest-cli --share') local result = run_command('speedtest-cli --share')
local url = result:match("Share results: (.*)") local url = result:match("Share results: (.*)")
print('URL: '..url)
local text = 'http://www.speedtest.net/my-result/'..url:match('http://www.speedtest.net/result/(.*).png')
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local photo = download_to_file(url, 'speedtest_cli.png') if not url then
if not photo then
utilities.send_reply(msg, config.errors.connection) utilities.send_reply(msg, config.errors.connection)
return return
end end
utilities.send_photo(msg.chat.id, photo, nil, msg.message_id) utilities.send_photo(msg.chat.id, url, text, msg.message_id)
end end
return speedtest_cli return speedtest_cli

View File

@ -73,8 +73,7 @@ function wordpress_recent_post:action(msg, config, matches)
if image_url then if image_url then
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local file = download_to_file(image_url) utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
end end
utilities.send_reply(msg, text, 'HTML') utilities.send_reply(msg, text, 'HTML')
end end

View File

@ -17,8 +17,12 @@ function yandere:get_post(tag)
if not yan[1] then return nil end if not yan[1] then return nil end
local i = math.random(#yan) local i = math.random(#yan)
local link_image = yan[i].file_url local url = yan[i].file_url
return link_image local resolution = yan[i].jpeg_width..'x'..yan[i].jpeg_height..'px'
local size = ' '..math.ceil(yan[i].file_size/1000)
local source_url = '\nhttps://yande.re/post/show/'..yan[i].id
local text = resolution..size..'kb'..source_url
return url, size, text
end end
function yandere:action(msg, config) function yandere:action(msg, config)
@ -29,15 +33,36 @@ function yandere:action(msg, config)
end end
local tag = string.gsub(input, " ", '_' ) local tag = string.gsub(input, " ", '_' )
local url = yandere:get_post(tag) local tag = string.gsub(input, ":", '%%3A')
local tag = string.gsub(input, "+", '%%20')
local url, size, text = yandere:get_post(tag)
print('URL: '..url)
-- don't send GIFs when they're bigger than 20 MB
-- don't send photos when they're bigger than 5 MB
if string.ends(url, ".gif") then
if tonumber(size) > 19900 then
utilities.send_reply(msg, 'Sorry, die GIF ist zu groß.\n'..text)
return
end
else
if tonumber(size) > 4900 then
utilities.send_reply(msg, 'Sorry, das Bild ist zu groß.\n'..text)
return
end
end
if not url then if not url then
utilities.send_reply(msg, config.errors.results) utilities.send_reply(msg, 'Nobody here but us chickens!')
return return
end end
utilities.send_typing(msg.chat.id, 'upload_photo') utilities.send_typing(msg.chat.id, 'upload_photo')
local file = download_to_file(url) if string.ends(url, ".gif") then
utilities.send_photo(msg.chat.id, file, nil, msg.message_id) utilities.send_document(msg.chat.id, url, text, msg.message_id)
utilities.send_reply(msg, url) else
utilities.send_photo(msg.chat.id, url, text, msg.message_id)
end
end end
return yandere return yandere