From f85d753491a8c0584a66697f65d5f0c1367e0f89 Mon Sep 17 00:00:00 2001 From: juanmal Date: Fri, 13 Feb 2015 01:55:16 +0100 Subject: [PATCH] Update twitter.lua Send multiple images from tweet --- plugins/twitter.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/twitter.lua b/plugins/twitter.lua index 725873a..f7c15f0 100644 --- a/plugins/twitter.lua +++ b/plugins/twitter.lua @@ -47,8 +47,8 @@ function run(msg, matches) -- remove images local images = {} - if response.entities.media then - for k, v in pairs(response.entities.media) do + if response.extended_entities.media then + for k, v in pairs(response.extended_entities.media) do local url = v.url local pic = v.media_url text = text:gsub(url, "") @@ -62,6 +62,7 @@ function run(msg, matches) for k, v in pairs(images) do local file = download_to_file(v) send_photo(receiver, file, ok_cb, false) + delay_s(1) end return nil @@ -72,4 +73,4 @@ return { usage = "", patterns = {"https://twitter.com/[^/]+/status/([0-9]+)"}, run = run -} \ No newline at end of file +}