From 0b62c7d947429ae21645525e6197bec114b080b6 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Wed, 21 Sep 2016 22:38:47 +0200 Subject: [PATCH] =?UTF-8?q?get=5Ftxt.lua:=20K=C3=BCrzeText,=20wenn=20l?= =?UTF-8?q?=C3=A4nger=20als=20500=20Zeichen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miku/plugins/get_txt.lua | 7 ++++++- miku/plugins/rss.lua | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/miku/plugins/get_txt.lua b/miku/plugins/get_txt.lua index 2c8599e..225d036 100644 --- a/miku/plugins/get_txt.lua +++ b/miku/plugins/get_txt.lua @@ -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 \ No newline at end of file diff --git a/miku/plugins/rss.lua b/miku/plugins/rss.lua index 3ea8ab4..baed4ec 100644 --- a/miku/plugins/rss.lua +++ b/miku/plugins/rss.lua @@ -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)