- 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)
|
||||
if not image_url then return end
|
||||
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_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
return
|
||||
elseif matches[1] == 'video' or matches[2] == 'videos' 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 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 file
|
||||
return url
|
||||
end
|
||||
|
||||
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
|
||||
local data = json.decode(res).gfyItem
|
||||
utilities.send_typing(msg.chat.id, 'upload_video')
|
||||
local file = download_to_file(data.webmUrl)
|
||||
if file == nil then
|
||||
send_reply(msg, 'Fehler beim Herunterladen von '..name)
|
||||
return
|
||||
local file = download_to_file(data.mp4Url)
|
||||
if tonumber(data.mp4Size) > 20971520 then
|
||||
file = download_to_file(data.mp4Url)
|
||||
else
|
||||
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
||||
return
|
||||
file = data.mp4Url
|
||||
end
|
||||
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
||||
end
|
||||
|
||||
function gfycat:action(msg, config, matches)
|
||||
|
@ -54,8 +54,7 @@ function golem:action(msg, config, matches)
|
||||
|
||||
if image_url then
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(image_url)
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
utilities.send_reply(msg, text, true)
|
||||
end
|
||||
|
@ -45,8 +45,7 @@ function gps:action(msg, config, matches)
|
||||
for i in ipairs(zooms) do
|
||||
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 file = download_to_file(url, 'zoom_'..i..'.png')
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, url, nil, msg.message_id)
|
||||
end
|
||||
|
||||
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 image_url then
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(image_url, 'heise_teaser.jpg')
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
utilities.send_reply(msg, text, true)
|
||||
end
|
||||
|
@ -90,12 +90,10 @@ function imdb:action(msg, config)
|
||||
output = output..string.gsub(jdat.imdbRating, '%.', ',')..'/10 | '..jdat.Runtime..' | '.. jdat.Genre..'\n'
|
||||
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
|
||||
local file = download_to_file(jdat.Poster)
|
||||
utilities.send_photo(msg.chat.id, file)
|
||||
utilities.send_photo(msg.chat.id, jdat.Poster)
|
||||
end
|
||||
utilities.send_reply(msg, output, 'HTML', '{"inline_keyboard":[[{"text":"IMDb-Seite aufrufen","url":"http://imdb.com/title/'.. jdat.imdbID..'"}]]}')
|
||||
end
|
||||
|
||||
return imdb
|
@ -42,9 +42,9 @@ function media:action(msg, config, matches)
|
||||
if ext == 'gif' then
|
||||
result = utilities.send_document(receiver, file, nil, msg.message_id)
|
||||
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
|
||||
result = utilities.send_audio(receiver, file, msg.message_id)
|
||||
result = utilities.send_audio(receiver, file, nil, msg.message_id)
|
||||
elseif mime_type == 'video' then
|
||||
result = utilities.send_video(receiver, file, nil, msg.message_id)
|
||||
else
|
||||
|
@ -105,9 +105,8 @@ function pixabay:action(msg, config, matches)
|
||||
return
|
||||
else
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(url)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -90,7 +90,7 @@ function plugin_manager:reload_plugins(self, config, plugin_name, status)
|
||||
if plugin_name then
|
||||
return 'Plugin '..plugin_name..' wurde '..status
|
||||
else
|
||||
return 'Plugins neu geladen'
|
||||
return 'Plugins neu geladen ✔️'
|
||||
end
|
||||
end
|
||||
|
||||
@ -106,31 +106,31 @@ function plugin_manager:enable_plugin(self, config, plugin_name)
|
||||
redis:sadd('telegram:enabled_plugins', plugin_name)
|
||||
print(plugin_name..' saved to redis set telegram:enabled_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
|
||||
return 'Plugin '..plugin_name..' existiert nicht'
|
||||
return 'Plugin '..plugin_name..' existiert nicht ❌'
|
||||
end
|
||||
end
|
||||
|
||||
function plugin_manager:disable_plugin(self, config, name, chat)
|
||||
-- Check if plugins exists
|
||||
if not plugin_manager:plugin_exists(name) then
|
||||
return 'Plugin '..name..' existiert nicht'
|
||||
return 'Plugin '..name..' existiert nicht ❌'
|
||||
end
|
||||
local k = plugin_manager:plugin_enabled(name)
|
||||
-- Check if plugin is enabled
|
||||
if not k then
|
||||
return 'Plugin '..name..' ist nicht aktiviert'
|
||||
return 'Plugin '..name..' ist nicht aktiviert ❌'
|
||||
end
|
||||
-- Disable and reload
|
||||
redis:srem('telegram:enabled_plugins', name)
|
||||
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
|
||||
|
||||
function plugin_manager:disable_plugin_on_chat(msg, plugin)
|
||||
if not plugin_manager:plugin_exists(plugin) then
|
||||
return "Plugin existiert nicht!"
|
||||
return "Plugin existiert nicht! ❌"
|
||||
end
|
||||
|
||||
if not msg.chat then
|
||||
@ -143,15 +143,15 @@ function plugin_manager:disable_plugin_on_chat(msg, plugin)
|
||||
if disabled ~= 'true' then
|
||||
print('Setting '..plugin..' in redis hash '..hash..' to true')
|
||||
redis:hset(hash, plugin, true)
|
||||
return 'Plugin '..plugin..' für diesen Chat deaktiviert.'
|
||||
return 'Plugin '..plugin..' für diesen Chat deaktiviert. ✔️'
|
||||
else
|
||||
return 'Plugin '..plugin..' wurde für diesen Chat bereits deaktiviert.'
|
||||
return 'Plugin '..plugin..' wurde für diesen Chat bereits deaktiviert. ✔️'
|
||||
end
|
||||
end
|
||||
|
||||
function plugin_manager:reenable_plugin_on_chat(msg, plugin)
|
||||
if not plugin_manager:plugin_exists(plugin) then
|
||||
return "Plugin existiert nicht!"
|
||||
return "Plugin existiert nicht! ❌"
|
||||
end
|
||||
|
||||
if not msg.chat then
|
||||
@ -161,14 +161,14 @@ function plugin_manager:reenable_plugin_on_chat(msg, plugin)
|
||||
end
|
||||
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
|
||||
print('Setting '..plugin..' in redis hash '..hash..' to 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
|
||||
return 'Plugin '..plugin..' ist nicht deaktiviert.'
|
||||
return 'Plugin '..plugin..' ist nicht deaktiviert. ✔️'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -109,8 +109,7 @@ function qr:action(msg, config, matches)
|
||||
|
||||
local image_url = qr:qr(text, color, back)
|
||||
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, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
|
||||
return qr
|
||||
|
@ -8,8 +8,7 @@ speedtest.triggers = {
|
||||
function speedtest:action(msg, config, matches)
|
||||
local url = 'http://www.speedtest.net/result/'..matches[1]..'.png'
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(url)
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, url, nil, msg.message_id)
|
||||
end
|
||||
|
||||
return speedtest
|
@ -26,15 +26,13 @@ function spotify:send_track_data(data, msg)
|
||||
local totalseconds = math.floor(milliseconds / 1000)
|
||||
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
|
||||
utilities.send_typing(msg.chat.id, 'upload_audio')
|
||||
local file = download_to_file(preview, name..'.mp3')
|
||||
utilities.send_audio(msg.chat.id, file, msg.message_id, totalseconds, artist, name)
|
||||
return
|
||||
utilities.send_audio(msg.chat.id, file, 'Aus dem Album "'..album..'"\nLänge: '..duration, msg.message_id, 30, artist, name)
|
||||
else
|
||||
utilities.send_reply(msg, text, true)
|
||||
return
|
||||
utilities.send_reply(msg, text, 'HTML')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -51,7 +51,7 @@ function steam:action(msg, config, matches)
|
||||
|
||||
local text, image_url = steam:send_steam_data(data, msg)
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -69,8 +69,7 @@ function tv:send_tv_data(result, msg)
|
||||
if xml.find(result, 'banner') then
|
||||
local image_url = 'http://www.thetvdb.com/banners/'..xml.find(result, 'banner')[1]
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(image_url)
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, nil, msg.message_id)
|
||||
end
|
||||
utilities.send_reply(msg, text, true)
|
||||
end
|
||||
|
@ -163,12 +163,10 @@ function twitter:action(msg, config, matches)
|
||||
-- send the parts
|
||||
utilities.send_reply(msg, text, 'HTML')
|
||||
for k, v in pairs(images) do
|
||||
local file = download_to_file(v)
|
||||
utilities.send_photo(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, v, nil, msg.message_id)
|
||||
end
|
||||
for k, v in pairs(videos) do
|
||||
local file = download_to_file(v)
|
||||
utilities.send_video(msg.chat.id, file, nil, msg.message_id)
|
||||
utilities.send_video(msg.chat.id, v, nil, msg.message_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -169,13 +169,23 @@ function twitter_send:twitter_verify_credentials(oauth_token, oauth_token_secret
|
||||
location = ''
|
||||
end
|
||||
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
|
||||
url = twitter_send:resolve_url(response.url)..'\n'
|
||||
url = response.url..'\n'
|
||||
else
|
||||
url = '\n'
|
||||
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 favorites = comma_value(response.favourites_count)
|
||||
@ -338,15 +348,14 @@ function twitter_send:action(msg, config, matches)
|
||||
|
||||
if matches[1] == 'verify' then
|
||||
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, file, nil, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, pp_url, nil, msg.message_id)
|
||||
utilities.send_reply(msg, text)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
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)
|
||||
return
|
||||
else
|
||||
|
@ -88,15 +88,14 @@ function twitter_user:action(msg, config, matches)
|
||||
|
||||
local pic_url = string.gsub(response.profile_image_url_https, "normal", "400x400")
|
||||
utilities.send_typing(msg.chat.id, 'upload_photo')
|
||||
local file = download_to_file(pic_url)
|
||||
|
||||
local text = header..body..footer
|
||||
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)
|
||||
return
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -25,8 +25,7 @@ function vine:send_vine_data(data)
|
||||
if data.explicitContent == 1 then
|
||||
text = text..' (🔞 NSFW 🔞)'
|
||||
end
|
||||
local file = download_to_file(video_url, data.shortId..'.mp4')
|
||||
return text, file
|
||||
return text, video_url
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
utilities.send_typing(msg.chat.id, 'upload_video')
|
||||
local text, file = vine:send_vine_data(data)
|
||||
utilities.send_video(msg.chat.id, file, text, msg.message_id)
|
||||
local text, video_url = vine:send_vine_data(data)
|
||||
utilities.send_video(msg.chat.id, video_url, text, msg.message_id)
|
||||
end
|
||||
|
||||
return vine
|
||||
|
@ -136,8 +136,7 @@ function send_youtube_data(data, msg, self, link, sendpic)
|
||||
if blocked then
|
||||
text = text..'\nACHTUNG, In Deutschland gesperrt!'
|
||||
end
|
||||
local file = download_to_file(image_url)
|
||||
utilities.send_photo(msg.chat.id, file, text, msg.message_id)
|
||||
utilities.send_photo(msg.chat.id, image_url, text, msg.message_id)
|
||||
else
|
||||
utilities.send_reply(msg, text, 'HTML')
|
||||
end
|
||||
|
@ -127,12 +127,13 @@ function utilities.send_photo(chat_id, file, text, reply_to_message_id, reply_ma
|
||||
end
|
||||
|
||||
-- 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
|
||||
local output = bindings.request(
|
||||
'sendAudio',
|
||||
{
|
||||
chat_id = chat_id,
|
||||
caption = text or nil,
|
||||
duration = duration or nil,
|
||||
performer = performer or nil,
|
||||
title = title or nil,
|
||||
@ -197,12 +198,13 @@ end
|
||||
|
||||
-- NOTE: Voice messages are .ogg files encoded with OPUS
|
||||
-- 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
|
||||
local output = bindings.request(
|
||||
'sendVoice',
|
||||
{
|
||||
chat_id = chat_id,
|
||||
caption = text or nil,
|
||||
duration = duration or nil,
|
||||
reply_to_message_id = reply_to_message_id
|
||||
},
|
||||
|
Reference in New Issue
Block a user