- Fixe Gfycat
- Mehr Verbesserungen für das 3. Oktober Update
This commit is contained in:
parent
7f45f4d736
commit
2a3cbeab6d
@ -147,9 +147,8 @@ function facebook:action(msg, config, matches)
|
|||||||
local text, image_url = facebook:send_facebook_photo(photo_id, receiver)
|
local text, image_url = facebook:send_facebook_photo(photo_id, receiver)
|
||||||
if not image_url then return end
|
if not image_url then return end
|
||||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
local file = download_to_file(image_url, 'photo.jpg')
|
|
||||||
utilities.send_reply(msg, text, 'HTML')
|
utilities.send_reply(msg, text, 'HTML')
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||||
return
|
return
|
||||||
elseif matches[1] == 'video' or matches[2] == 'videos' then
|
elseif matches[1] == 'video' or matches[2] == 'videos' then
|
||||||
if not matches[3] then
|
if not matches[3] then
|
||||||
|
@ -15,8 +15,7 @@ function gMaps:get_staticmap(area, lat, lon)
|
|||||||
local base_api = "https://maps.googleapis.com/maps/api"
|
local base_api = "https://maps.googleapis.com/maps/api"
|
||||||
local url = base_api .. "/staticmap?size=600x300&zoom=12¢er="..URL.escape(area).."&markers=color:red"..URL.escape("|"..area)
|
local url = base_api .. "/staticmap?size=600x300&zoom=12¢er="..URL.escape(area).."&markers=color:red"..URL.escape("|"..area)
|
||||||
|
|
||||||
local file = download_to_file(url)
|
return url
|
||||||
return file
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function gMaps:inline_callback(inline_query, config, matches)
|
function gMaps:inline_callback(inline_query, config, matches)
|
||||||
|
@ -13,14 +13,13 @@ function gfycat:send_gfycat_video(name, msg)
|
|||||||
if code ~= 200 then return "HTTP-FEHLER" end
|
if code ~= 200 then return "HTTP-FEHLER" end
|
||||||
local data = json.decode(res).gfyItem
|
local data = json.decode(res).gfyItem
|
||||||
utilities.send_typing(msg.chat.id, 'upload_video')
|
utilities.send_typing(msg.chat.id, 'upload_video')
|
||||||
local file = download_to_file(data.webmUrl)
|
local file = download_to_file(data.mp4Url)
|
||||||
if file == nil then
|
if tonumber(data.mp4Size) > 20971520 then
|
||||||
send_reply(msg, 'Fehler beim Herunterladen von '..name)
|
file = download_to_file(data.mp4Url)
|
||||||
return
|
|
||||||
else
|
else
|
||||||
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
file = data.mp4Url
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
function gfycat:action(msg, config, matches)
|
function gfycat:action(msg, config, matches)
|
||||||
|
@ -54,8 +54,7 @@ function golem: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, true)
|
utilities.send_reply(msg, text, true)
|
||||||
end
|
end
|
||||||
|
@ -45,8 +45,7 @@ function gps:action(msg, config, matches)
|
|||||||
for i in ipairs(zooms) do
|
for i in ipairs(zooms) do
|
||||||
local zoom = zooms[i]
|
local zoom = zooms[i]
|
||||||
local url = "https://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=hybrid¢er=" .. lat .. "," .. lon .. "&markers=color:red%7Clabel:•%7C" .. lat .. "," .. lon
|
local url = "https://maps.googleapis.com/maps/api/staticmap?zoom=" .. zoom .. "&size=600x300&maptype=hybrid¢er=" .. lat .. "," .. lon .. "&markers=color:red%7Clabel:•%7C" .. lat .. "," .. lon
|
||||||
local file = download_to_file(url, 'zoom_'..i..'.png')
|
utilities.send_photo(msg.chat.id, url, nil, msg.message_id)
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
utilities.send_location(msg.chat.id, lat, lon, msg.message_id)
|
utilities.send_location(msg.chat.id, lat, lon, msg.message_id)
|
||||||
|
@ -34,8 +34,7 @@ function heise:action(msg, config, matches)
|
|||||||
if not text then return end
|
if not text then return end
|
||||||
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, 'heise_teaser.jpg')
|
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, true)
|
utilities.send_reply(msg, text, true)
|
||||||
end
|
end
|
||||||
|
@ -90,12 +90,10 @@ function imdb:action(msg, config)
|
|||||||
output = output..string.gsub(jdat.imdbRating, '%.', ',')..'/10 | '..jdat.Runtime..' | '.. jdat.Genre..'\n'
|
output = output..string.gsub(jdat.imdbRating, '%.', ',')..'/10 | '..jdat.Runtime..' | '.. jdat.Genre..'\n'
|
||||||
output = output..'<i>' .. jdat.Plot .. '</i>'
|
output = output..'<i>' .. jdat.Plot .. '</i>'
|
||||||
|
|
||||||
utilities.send_reply(msg, output, 'HTML', '{"inline_keyboard":[[{"text":"IMDb-Seite aufrufen","url":"http://imdb.com/title/'.. jdat.imdbID..'"}]]}')
|
|
||||||
|
|
||||||
if jdat.Poster ~= "N/A" then
|
if jdat.Poster ~= "N/A" then
|
||||||
local file = download_to_file(jdat.Poster)
|
utilities.send_photo(msg.chat.id, jdat.Poster)
|
||||||
utilities.send_photo(msg.chat.id, file)
|
|
||||||
end
|
end
|
||||||
|
utilities.send_reply(msg, output, 'HTML', '{"inline_keyboard":[[{"text":"IMDb-Seite aufrufen","url":"http://imdb.com/title/'.. jdat.imdbID..'"}]]}')
|
||||||
end
|
end
|
||||||
|
|
||||||
return imdb
|
return imdb
|
@ -42,9 +42,9 @@ function media:action(msg, config, matches)
|
|||||||
if ext == 'gif' then
|
if ext == 'gif' then
|
||||||
result = utilities.send_document(receiver, file, nil, msg.message_id)
|
result = utilities.send_document(receiver, file, nil, msg.message_id)
|
||||||
elseif ext == 'ogg' then
|
elseif ext == 'ogg' then
|
||||||
result = utilities.send_voice(receiver, file, msg.message_id)
|
result = utilities.send_voice(receiver, file, nil, msg.message_id)
|
||||||
elseif mime_type == 'audio' then
|
elseif mime_type == 'audio' then
|
||||||
result = utilities.send_audio(receiver, file, msg.message_id)
|
result = utilities.send_audio(receiver, file, nil, msg.message_id)
|
||||||
elseif mime_type == 'video' then
|
elseif mime_type == 'video' then
|
||||||
result = utilities.send_video(receiver, file, nil, msg.message_id)
|
result = utilities.send_video(receiver, file, nil, msg.message_id)
|
||||||
else
|
else
|
||||||
|
@ -105,9 +105,8 @@ function pixabay:action(msg, config, matches)
|
|||||||
return
|
return
|
||||||
else
|
else
|
||||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
local file = download_to_file(url)
|
|
||||||
local text = '"'..tags..'" von '..user
|
local text = '"'..tags..'" von '..user
|
||||||
utilities.send_photo(msg.chat.id, file, text, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..page_url..'"},{"text":"Volles Bild (Login notwendig)","url":"'..full_url..'"}]]}')
|
utilities.send_photo(msg.chat.id, url, text, msg.message_id, '{"inline_keyboard":[[{"text":"Seite aufrufen","url":"'..page_url..'"},{"text":"Volles Bild (Login notwendig)","url":"'..full_url..'"}]]}')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -90,7 +90,7 @@ function plugin_manager:reload_plugins(self, config, plugin_name, status)
|
|||||||
if plugin_name then
|
if plugin_name then
|
||||||
return 'Plugin '..plugin_name..' wurde '..status
|
return 'Plugin '..plugin_name..' wurde '..status
|
||||||
else
|
else
|
||||||
return 'Plugins neu geladen'
|
return 'Plugins neu geladen ✔️'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -106,31 +106,31 @@ function plugin_manager:enable_plugin(self, config, plugin_name)
|
|||||||
redis:sadd('telegram:enabled_plugins', plugin_name)
|
redis:sadd('telegram:enabled_plugins', plugin_name)
|
||||||
print(plugin_name..' saved to redis set telegram:enabled_plugins')
|
print(plugin_name..' saved to redis set telegram:enabled_plugins')
|
||||||
-- Reload the plugins
|
-- Reload the plugins
|
||||||
return plugin_manager:reload_plugins(self, config, plugin_name, 'aktiviert')
|
return plugin_manager:reload_plugins(self, config, plugin_name, 'aktiviert ✔️')
|
||||||
else
|
else
|
||||||
return 'Plugin '..plugin_name..' existiert nicht'
|
return 'Plugin '..plugin_name..' existiert nicht ❌'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function plugin_manager:disable_plugin(self, config, name, chat)
|
function plugin_manager:disable_plugin(self, config, name, chat)
|
||||||
-- Check if plugins exists
|
-- Check if plugins exists
|
||||||
if not plugin_manager:plugin_exists(name) then
|
if not plugin_manager:plugin_exists(name) then
|
||||||
return 'Plugin '..name..' existiert nicht'
|
return 'Plugin '..name..' existiert nicht ❌'
|
||||||
end
|
end
|
||||||
local k = plugin_manager:plugin_enabled(name)
|
local k = plugin_manager:plugin_enabled(name)
|
||||||
-- Check if plugin is enabled
|
-- Check if plugin is enabled
|
||||||
if not k then
|
if not k then
|
||||||
return 'Plugin '..name..' ist nicht aktiviert'
|
return 'Plugin '..name..' ist nicht aktiviert ❌'
|
||||||
end
|
end
|
||||||
-- Disable and reload
|
-- Disable and reload
|
||||||
redis:srem('telegram:enabled_plugins', name)
|
redis:srem('telegram:enabled_plugins', name)
|
||||||
print(name..' saved to redis set telegram:enabled_plugins')
|
print(name..' saved to redis set telegram:enabled_plugins')
|
||||||
return plugin_manager:reload_plugins(self, config, name, 'deaktiviert')
|
return plugin_manager:reload_plugins(self, config, name, 'deaktiviert ✔️')
|
||||||
end
|
end
|
||||||
|
|
||||||
function plugin_manager:disable_plugin_on_chat(msg, plugin)
|
function plugin_manager:disable_plugin_on_chat(msg, plugin)
|
||||||
if not plugin_manager:plugin_exists(plugin) then
|
if not plugin_manager:plugin_exists(plugin) then
|
||||||
return "Plugin existiert nicht!"
|
return "Plugin existiert nicht! ❌"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not msg.chat then
|
if not msg.chat then
|
||||||
@ -143,15 +143,15 @@ function plugin_manager:disable_plugin_on_chat(msg, plugin)
|
|||||||
if disabled ~= 'true' then
|
if disabled ~= 'true' then
|
||||||
print('Setting '..plugin..' in redis hash '..hash..' to true')
|
print('Setting '..plugin..' in redis hash '..hash..' to true')
|
||||||
redis:hset(hash, plugin, true)
|
redis:hset(hash, plugin, true)
|
||||||
return 'Plugin '..plugin..' für diesen Chat deaktiviert.'
|
return 'Plugin '..plugin..' für diesen Chat deaktiviert. ✔️'
|
||||||
else
|
else
|
||||||
return 'Plugin '..plugin..' wurde für diesen Chat bereits deaktiviert.'
|
return 'Plugin '..plugin..' wurde für diesen Chat bereits deaktiviert. ✔️'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function plugin_manager:reenable_plugin_on_chat(msg, plugin)
|
function plugin_manager:reenable_plugin_on_chat(msg, plugin)
|
||||||
if not plugin_manager:plugin_exists(plugin) then
|
if not plugin_manager:plugin_exists(plugin) then
|
||||||
return "Plugin existiert nicht!"
|
return "Plugin existiert nicht! ❌"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not msg.chat then
|
if not msg.chat then
|
||||||
@ -161,14 +161,14 @@ function plugin_manager:reenable_plugin_on_chat(msg, plugin)
|
|||||||
end
|
end
|
||||||
local disabled = redis:hget(hash, plugin)
|
local disabled = redis:hget(hash, plugin)
|
||||||
|
|
||||||
if disabled == nil then return 'Es gibt keine deaktivierten Plugins für disen Chat.' end
|
if disabled == nil then return 'Es gibt keine deaktivierten Plugins für disen Chat. ❌' end
|
||||||
|
|
||||||
if disabled == 'true' then
|
if disabled == 'true' then
|
||||||
print('Setting '..plugin..' in redis hash '..hash..' to false')
|
print('Setting '..plugin..' in redis hash '..hash..' to false')
|
||||||
redis:hset(hash, plugin, false)
|
redis:hset(hash, plugin, false)
|
||||||
return 'Plugin '..plugin..' wurde für diesen Chat reaktiviert.'
|
return 'Plugin '..plugin..' wurde für diesen Chat reaktiviert. ✔️'
|
||||||
else
|
else
|
||||||
return 'Plugin '..plugin..' ist nicht deaktiviert.'
|
return 'Plugin '..plugin..' ist nicht deaktiviert. ✔️'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -109,8 +109,7 @@ function qr:action(msg, config, matches)
|
|||||||
|
|
||||||
local image_url = qr:qr(text, color, back)
|
local image_url = qr:qr(text, color, back)
|
||||||
if not image_url then utilities.send_reply(msg, config.errors.connection) return end
|
if not image_url then utilities.send_reply(msg, config.errors.connection) return end
|
||||||
local file = download_to_file(image_url, 'qr.png')
|
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
|
||||||
|
|
||||||
return qr
|
return qr
|
||||||
|
@ -8,8 +8,7 @@ speedtest.triggers = {
|
|||||||
function speedtest:action(msg, config, matches)
|
function speedtest:action(msg, config, matches)
|
||||||
local url = 'http://www.speedtest.net/result/'..matches[1]..'.png'
|
local url = 'http://www.speedtest.net/result/'..matches[1]..'.png'
|
||||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
local file = download_to_file(url)
|
utilities.send_photo(msg.chat.id, url, nil, msg.message_id)
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return speedtest
|
return speedtest
|
@ -16,26 +16,24 @@ function spotify:get_track_data(track)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function spotify:send_track_data(data, msg)
|
function spotify:send_track_data(data, msg)
|
||||||
local name = data.name
|
local name = data.name
|
||||||
local album = data.album.name
|
local album = data.album.name
|
||||||
local artist = data.artists[1].name
|
local artist = data.artists[1].name
|
||||||
local preview = data.preview_url
|
local preview = data.preview_url
|
||||||
local milliseconds = data.duration_ms
|
local milliseconds = data.duration_ms
|
||||||
|
|
||||||
-- convert s to mm:ss
|
-- convert s to mm:ss
|
||||||
local totalseconds = math.floor(milliseconds / 1000)
|
local totalseconds = math.floor(milliseconds / 1000)
|
||||||
local duration = makeHumanTime(totalseconds)
|
local duration = makeHumanTime(totalseconds)
|
||||||
|
|
||||||
local text = '*'..name..'* von *'..artist..'* aus dem Album *'..album..'* _('..duration..')_'
|
local text = '<b>'..name..'</b> von <b>'..artist..'</b> aus dem Album <b>'..album..'</b> <i>('..duration..')</i>'
|
||||||
if preview then
|
if preview then
|
||||||
utilities.send_typing(msg.chat.id, 'upload_audio')
|
utilities.send_typing(msg.chat.id, 'upload_audio')
|
||||||
local file = download_to_file(preview, name..'.mp3')
|
local file = download_to_file(preview, name..'.mp3')
|
||||||
utilities.send_audio(msg.chat.id, file, msg.message_id, totalseconds, artist, name)
|
utilities.send_audio(msg.chat.id, file, 'Aus dem Album "'..album..'"\nLänge: '..duration, msg.message_id, 30, artist, name)
|
||||||
return
|
else
|
||||||
else
|
utilities.send_reply(msg, text, 'HTML')
|
||||||
utilities.send_reply(msg, text, true)
|
end
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function spotify:action(msg, config, matches)
|
function spotify:action(msg, config, matches)
|
||||||
|
@ -51,7 +51,7 @@ function steam:action(msg, config, matches)
|
|||||||
|
|
||||||
local text, image_url = steam:send_steam_data(data, msg)
|
local text, image_url = steam:send_steam_data(data, msg)
|
||||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
utilities.send_photo(msg.chat.id, download_to_file(image_url, matches[1]..'.jpg'), nil, msg.message_id)
|
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||||
utilities.send_reply(msg, text, true)
|
utilities.send_reply(msg, text, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -69,8 +69,7 @@ function tv:send_tv_data(result, msg)
|
|||||||
if xml.find(result, 'banner') then
|
if xml.find(result, 'banner') then
|
||||||
local image_url = 'http://www.thetvdb.com/banners/'..xml.find(result, 'banner')[1]
|
local image_url = 'http://www.thetvdb.com/banners/'..xml.find(result, 'banner')[1]
|
||||||
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, true)
|
utilities.send_reply(msg, text, true)
|
||||||
end
|
end
|
||||||
|
@ -163,12 +163,10 @@ function twitter:action(msg, config, matches)
|
|||||||
-- send the parts
|
-- send the parts
|
||||||
utilities.send_reply(msg, text, 'HTML')
|
utilities.send_reply(msg, text, 'HTML')
|
||||||
for k, v in pairs(images) do
|
for k, v in pairs(images) do
|
||||||
local file = download_to_file(v)
|
utilities.send_photo(msg.chat.id, v, nil, msg.message_id)
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
|
||||||
end
|
end
|
||||||
for k, v in pairs(videos) do
|
for k, v in pairs(videos) do
|
||||||
local file = download_to_file(v)
|
utilities.send_video(msg.chat.id, v, nil, msg.message_id)
|
||||||
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -169,12 +169,22 @@ function twitter_send:twitter_verify_credentials(oauth_token, oauth_token_secret
|
|||||||
location = ''
|
location = ''
|
||||||
end
|
end
|
||||||
if response.url and response.location ~= '' then
|
if response.url and response.location ~= '' then
|
||||||
url = ' | '..twitter_send:resolve_url(response.url)..'\n'
|
url = ' | '..response.url..'\n'
|
||||||
elseif response.url and response.location == '' then
|
elseif response.url and response.location == '' then
|
||||||
url = twitter_send:resolve_url(response.url)..'\n'
|
url = response.url..'\n'
|
||||||
else
|
else
|
||||||
url = '\n'
|
url = '\n'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- replace short url
|
||||||
|
if response.entities.url then
|
||||||
|
for k, v in pairs(response.entities.url.urls) do
|
||||||
|
local short = v.url
|
||||||
|
local long = v.expanded_url
|
||||||
|
local long = long:gsub('%%', '%%%%')
|
||||||
|
url = url:gsub(short, long)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local body = description..'\n'..location..url
|
local body = description..'\n'..location..url
|
||||||
|
|
||||||
@ -338,15 +348,14 @@ function twitter_send:action(msg, config, matches)
|
|||||||
|
|
||||||
if matches[1] == 'verify' then
|
if matches[1] == 'verify' then
|
||||||
local text, pp_url = twitter_send:twitter_verify_credentials(oauth_token, oauth_token_secret)
|
local text, pp_url = twitter_send:twitter_verify_credentials(oauth_token, oauth_token_secret)
|
||||||
local file = download_to_file(pp_url)
|
utilities.send_photo(msg.chat.id, pp_url, nil, msg.message_id)
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
|
||||||
utilities.send_reply(msg, text)
|
utilities.send_reply(msg, text)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
|
if msg.chat.type == 'group' or msg.chat.type == 'supergroup' then
|
||||||
if not can_send_tweet(msg) then
|
if not can_send_tweet(msg) and not is_sudo(msg, config) then
|
||||||
utilities.send_reply(msg, '*Du darfst keine Tweets senden.* Entweder wurdest du noch gar nicht freigeschaltet oder ausgeschlossen.', true)
|
utilities.send_reply(msg, '*Du darfst keine Tweets senden.* Entweder wurdest du noch gar nicht freigeschaltet oder ausgeschlossen.', true)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
@ -88,15 +88,14 @@ function twitter_user:action(msg, config, matches)
|
|||||||
|
|
||||||
local pic_url = string.gsub(response.profile_image_url_https, "normal", "400x400")
|
local pic_url = string.gsub(response.profile_image_url_https, "normal", "400x400")
|
||||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||||
local file = download_to_file(pic_url)
|
|
||||||
|
|
||||||
local text = header..body..footer
|
local text = header..body..footer
|
||||||
if string.len(text) > 199 then -- can only send captions with < 200 characters
|
if string.len(text) > 199 then -- can only send captions with < 200 characters
|
||||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
utilities.send_photo(msg.chat.id, pic_url, nil, msg.message_id)
|
||||||
utilities.send_reply(msg, text)
|
utilities.send_reply(msg, text)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
utilities.send_photo(msg.chat.id, file, text, msg.message_id)
|
utilities.send_photo(msg.chat.id, pic_url, text, msg.message_id)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -25,8 +25,7 @@ function vine:send_vine_data(data)
|
|||||||
if data.explicitContent == 1 then
|
if data.explicitContent == 1 then
|
||||||
text = text..' (🔞 NSFW 🔞)'
|
text = text..' (🔞 NSFW 🔞)'
|
||||||
end
|
end
|
||||||
local file = download_to_file(video_url, data.shortId..'.mp4')
|
return text, video_url
|
||||||
return text, file
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function vine:action(msg, config, matches)
|
function vine:action(msg, config, matches)
|
||||||
@ -34,8 +33,8 @@ function vine:action(msg, config, matches)
|
|||||||
if not data then utilities.send_reply(msg, config.errors.connection) return end
|
if not data then utilities.send_reply(msg, config.errors.connection) return end
|
||||||
|
|
||||||
utilities.send_typing(msg.chat.id, 'upload_video')
|
utilities.send_typing(msg.chat.id, 'upload_video')
|
||||||
local text, file = vine:send_vine_data(data)
|
local text, video_url = vine:send_vine_data(data)
|
||||||
utilities.send_video(msg.chat.id, file, text, msg.message_id)
|
utilities.send_video(msg.chat.id, video_url, text, msg.message_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
return vine
|
return vine
|
||||||
|
@ -136,8 +136,7 @@ function send_youtube_data(data, msg, self, link, sendpic)
|
|||||||
if blocked then
|
if blocked then
|
||||||
text = text..'\nACHTUNG, In Deutschland gesperrt!'
|
text = text..'\nACHTUNG, In Deutschland gesperrt!'
|
||||||
end
|
end
|
||||||
local file = download_to_file(image_url)
|
utilities.send_photo(msg.chat.id, image_url, text, msg.message_id)
|
||||||
utilities.send_photo(msg.chat.id, file, text, msg.message_id)
|
|
||||||
else
|
else
|
||||||
utilities.send_reply(msg, text, 'HTML')
|
utilities.send_reply(msg, text, 'HTML')
|
||||||
end
|
end
|
||||||
|
@ -127,12 +127,13 @@ function utilities.send_photo(chat_id, file, text, reply_to_message_id, reply_ma
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- https://core.telegram.org/bots/api#sendaudio
|
-- https://core.telegram.org/bots/api#sendaudio
|
||||||
function utilities.send_audio(chat_id, file, reply_to_message_id, duration, performer, title)
|
function utilities.send_audio(chat_id, file, text, reply_to_message_id, duration, performer, title)
|
||||||
if not file then return false end
|
if not file then return false end
|
||||||
local output = bindings.request(
|
local output = bindings.request(
|
||||||
'sendAudio',
|
'sendAudio',
|
||||||
{
|
{
|
||||||
chat_id = chat_id,
|
chat_id = chat_id,
|
||||||
|
caption = text or nil,
|
||||||
duration = duration or nil,
|
duration = duration or nil,
|
||||||
performer = performer or nil,
|
performer = performer or nil,
|
||||||
title = title or nil,
|
title = title or nil,
|
||||||
@ -197,12 +198,13 @@ end
|
|||||||
|
|
||||||
-- NOTE: Voice messages are .ogg files encoded with OPUS
|
-- NOTE: Voice messages are .ogg files encoded with OPUS
|
||||||
-- https://core.telegram.org/bots/api#sendvoice
|
-- https://core.telegram.org/bots/api#sendvoice
|
||||||
function utilities.send_voice(chat_id, file, reply_to_message_id, duration)
|
function utilities.send_voice(chat_id, file, text, reply_to_message_id, duration)
|
||||||
if not file then return false end
|
if not file then return false end
|
||||||
local output = bindings.request(
|
local output = bindings.request(
|
||||||
'sendVoice',
|
'sendVoice',
|
||||||
{
|
{
|
||||||
chat_id = chat_id,
|
chat_id = chat_id,
|
||||||
|
caption = text or nil,
|
||||||
duration = duration or nil,
|
duration = duration or nil,
|
||||||
reply_to_message_id = reply_to_message_id
|
reply_to_message_id = reply_to_message_id
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user