get_txt.lua: KürzeText, wenn länger als 500 Zeichen

This commit is contained in:
Akamaru 2016-09-21 22:38:47 +02:00
parent 85e220c5b9
commit 0b62c7d947
2 changed files with 10 additions and 5 deletions

View File

@ -15,7 +15,12 @@ function get_txt:action(msg, config, matches)
utilities.send_reply(msg, config.errors.connection)
return
end
utilities.send_reply(msg, res)
if string.len(res) > 500 then
result = string.sub(res:gsub("%b<>", ""), 1, 500)..'...\n(Text gekürzt, da länger als 500 Zeichen.)'
else
result = res
end
utilities.send_reply(msg, result)
end
return get_txt

View File

@ -329,20 +329,20 @@ function rss:cron()
local link = v2.link or v2.id or 'Kein Link'
if v2.content then
content = v2.content:gsub("%b<>", "")
if string.len(v2.content) > 300 then
if string.len(v2.content) > 250 then
content = cleanRSS(content)
content = unescape(content)
content = string.sub(content, 1, 300)..'...'
content = string.sub(content, 1, 250)..'...'
else
content = cleanRSS(content)
content = unescape(content)
end
elseif v2.summary then
content = v2.summary:gsub("%b<>", "")
if string.len(v2.summary) > 300 then
if string.len(v2.summary) > 250 then
content = cleanRSS(content)
content = unescape(content)
content = string.sub(content, 1, 300)..'...'
content = string.sub(content, 1, 250)..'...'
else
content = cleanRSS(content)
content = unescape(content)