clean up some old crap

This commit is contained in:
topkecleon 2016-02-26 11:46:14 -05:00
parent 75eea13ab4
commit 57d466d0fb

View File

@ -42,11 +42,11 @@ local action = function(msg)
sendReply(msg, config.errors.results) sendReply(msg, config.errors.results)
return return
end end
--
local url = jdat.responseData.results[1].unescapedUrl local url = jdat.responseData.results[1].unescapedUrl
local title = jdat.responseData.results[1].titleNoFormatting:gsub(' %- Wikipedia, the free encyclopedia', '') local title = jdat.responseData.results[1].titleNoFormatting:gsub(' %- Wikipedia, the free encyclopedia', '')
-- 'https://en.wikipedia.org/wiki/':len 30 -- 'https://en.wikipedia.org/wiki/':len() == 30
jstr, res = HTTPS.request(wurl .. url:sub(31)) jstr, res = HTTPS.request(wurl .. url:sub(31))
if res ~= 200 then if res ~= 200 then
sendReply(msg, config.error.connection) sendReply(msg, config.error.connection)
@ -70,8 +70,6 @@ local action = function(msg)
end end
title = title:gsub('%(.+%)', '') title = title:gsub('%(.+%)', '')
--local output = '[' .. title .. '](' .. url .. ')\n' .. text:gsub('%[.+]%','')
--local output = '*' .. title .. '*\n' .. text:gsub('%[.+]%','') .. '\n[Read more.](' .. url .. ')'
local esctitle = title:gsub("[%^$()%%.%[%]*+%-?]","%%%1") local esctitle = title:gsub("[%^$()%%.%[%]*+%-?]","%%%1")
local output = text:gsub('%[.+%]',''):gsub(esctitle, '*%1*') .. '\n' local output = text:gsub('%[.+%]',''):gsub(esctitle, '*%1*') .. '\n'
if url:find('%(') then if url:find('%(') then
@ -80,13 +78,6 @@ local action = function(msg)
output = output .. '[Read more.](' .. url .. ')' output = output .. '[Read more.](' .. url .. ')'
end end
--
--[[ Comment the previous block and uncomment this one for full-message,
-- "unlinked" link previews.
-- Invisible zero-width, non-joiner.
local output = '[](' .. jdat.responseData.results[1].url .. ')'
]]--
sendMessage(msg.chat.id, output, true, nil, true) sendMessage(msg.chat.id, output, true, nil, true)
end end