Integriere Telegram-Funktionen, wie sendPhoto, sendVideo, sendDocument, etc. in utilites.lua und update alle Plugins, damit sie diese Funktion nutzen
This commit is contained in:
@@ -26,6 +26,7 @@ function ninegag:get_9GAG()
|
||||
end
|
||||
|
||||
function ninegag:action(msg, config)
|
||||
utilities.send_typing(self, msg.chat.id, 'upload_photo')
|
||||
local url, title = ninegag:get_9GAG()
|
||||
if not url then
|
||||
utilities.send_reply(self, msg, config.errors.connection)
|
||||
@@ -33,9 +34,7 @@ function ninegag:action(msg, config)
|
||||
end
|
||||
|
||||
local file = download_to_file(url)
|
||||
bindings.sendPhoto(self, {chat_id = msg.chat.id, caption = title}, {photo = file} )
|
||||
os.remove(file)
|
||||
print("Deleted: "..file)
|
||||
utilities.send_photo(self, msg.chat.id, file, title)
|
||||
end
|
||||
|
||||
return ninegag
|
||||
|
@@ -47,6 +47,7 @@ function gImages:action(msg, config)
|
||||
return
|
||||
end
|
||||
|
||||
utilities.send_typing(self, msg.chat.id, 'upload_photo')
|
||||
local apikey = cred_data.google_apikey
|
||||
local cseid = cred_data.google_cse_id
|
||||
local BASE_URL = 'https://www.googleapis.com/customsearch/v1'
|
||||
@@ -68,9 +69,7 @@ function gImages:action(msg, config)
|
||||
local img_url = jdat.items[i].link
|
||||
|
||||
local file = download_to_file(img_url)
|
||||
bindings.sendPhoto(self, {chat_id = msg.chat.id, caption = img_url}, {photo = file} )
|
||||
os.remove(file)
|
||||
print("Deleted: "..file)
|
||||
utilities.send_photo(self, msg.chat.id, file, img_url)
|
||||
end
|
||||
|
||||
return gImages
|
||||
|
@@ -51,7 +51,7 @@ function imdb:action(msg, config)
|
||||
|
||||
if jdat.Poster ~= "N/A" then
|
||||
local file = download_to_file(jdat.Poster)
|
||||
bindings.sendPhoto(self, {chat_id = msg.chat.id}, {photo = file} )
|
||||
utilities.send_photo(self, msg.chat.id, file)
|
||||
end
|
||||
|
||||
end
|
||||
|
@@ -140,15 +140,11 @@ function twitter:action(msg)
|
||||
utilities.send_reply(self, msg, header .. "\n" .. text.."\n"..footer)
|
||||
for k, v in pairs(images) do
|
||||
local file = download_to_file(v)
|
||||
bindings.sendPhoto(self, {chat_id = msg.chat.id}, {photo = file} )
|
||||
os.remove(file)
|
||||
print("Deleted: "..file)
|
||||
utilities.send_photo(self, msg.chat.id, file, nil, msg.message_id)
|
||||
end
|
||||
for k, v in pairs(videos) do
|
||||
local file = download_to_file(v)
|
||||
bindings.sendVideo(self, {chat_id = msg.chat.id}, {video = file} )
|
||||
os.remove(file)
|
||||
print("Deleted: "..file)
|
||||
utilities.send_video(self, msg.chat.id, file, nil, msg.message_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -142,9 +142,7 @@ function send_youtube_data(data, msg, self, link, sendpic)
|
||||
text = text..'\nACHTUNG, In Deutschland gesperrt!'
|
||||
end
|
||||
local file = download_to_file(image_url)
|
||||
bindings.sendPhoto(self, {chat_id = msg.chat.id, reply_to_message_id = msg.message_id, caption = text }, {photo = file} )
|
||||
os.remove(file)
|
||||
print("Deleted: "..file)
|
||||
utilities.send_photo(self, msg.chat.id, file, text, msg.message_id)
|
||||
else
|
||||
utilities.send_reply(self, msg, text, true)
|
||||
end
|
||||
|
Reference in New Issue
Block a user