From a04abbcc50509c538978d904260bd99979fff218 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Wed, 12 Oct 2016 19:26:05 +0200 Subject: [PATCH] =?UTF-8?q?twitter.lua:=20Sende=20Tweetlink=20mit=20(f?= =?UTF-8?q?=C3=BCr=20twet.lua=20eig)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tweet.lua: Übersetzung rss.lua: cleanRSS --- miku/plugins/rss.lua | 1 + miku/plugins/tweet.lua | 24 ++++++++++++------------ miku/plugins/twitter.lua | 9 +++++---- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/miku/plugins/rss.lua b/miku/plugins/rss.lua index 69b5388..0d33378 100644 --- a/miku/plugins/rss.lua +++ b/miku/plugins/rss.lua @@ -68,6 +68,7 @@ function cleanRSS(str) str = string.gsub(str, '%[swr%]', '') str = string.gsub(str, '%[ndr%]', '') str = string.gsub(str, '%[mdr%]', '') + str = string.gsub(str, '%[rbb%]', '') str = string.gsub(str, '%[wdr%]', '') str = string.gsub(str, '%[hr%]', '') str = string.gsub(str, '%[br%]', '') diff --git a/miku/plugins/tweet.lua b/miku/plugins/tweet.lua index 3b03720..058cb85 100644 --- a/miku/plugins/tweet.lua +++ b/miku/plugins/tweet.lua @@ -6,26 +6,26 @@ tweet.command = 'tweet ' function tweet:init(config) if not cred_data.tw_consumer_key then - print('Missing config value: tw_consumer_key.') - print('tweet.lua will not be enabled.') + print('Fehlender Key: tw_consumer_key.') + print('tweet.lua wird nicht aktiviert.') return elseif not cred_data.tw_consumer_secret then - print('Missing config value: tw_consumer_secret.') - print('tweet.lua will not be enabled.') + print('Fehlender Key: tw_consumer_secret.') + print('tweet.lua wird nicht aktiviert.') return elseif not cred_data.tw_access_token then - print('Missing config value: tw_access_token.') - print('tweet.lua will not be enabled.') + print('Fehlender Key: tw_access_token.') + print('tweet.lua wird nicht aktiviert.') return elseif not cred_data.tw_access_token_secret then - print('Missing config value: tw_access_token_secret.') - print('tweet.lua will not be enabled.') + print('Fehlender Key: tw_access_token_secret.') + print('tweet.lua wird nicht aktiviert.') return end tweet.triggers = { - "^/tweet ([%w_%.%-]+)$", - "^/tweet ([%w_%.%-]+) (last)$" + "^/[Tt][Ww][Ee][Ee][Tt] ([%w_%.%-]+)$", + "^/[Tt][Ww][Ee][Ee][Tt] ([%w_%.%-]+) (last)$" } tweet.doc = [[* ]]..config.cmd_pat..[[tweet* __: Zufälliger Tweet vom User mit diesem Namen @@ -51,12 +51,12 @@ local client = OAuth.new(consumer_key, consumer_secret, { function tweet:get_random_tweet(base) local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url, base) if response_code ~= 200 then - return "Konnte nicht verbinden, evtl. existiert der User nicht?" + return "Konnte nicht verbinden. Evtl. existiert der User nicht?" end local response = json.decode(response_body) if #response == 0 then - return "Konnte keinen Tweet bekommen, sorry" + return "Konnte keinen Tweet bekommen." end local i = math.random(#response) diff --git a/miku/plugins/twitter.lua b/miku/plugins/twitter.lua index 7ba5ec7..adc4b4b 100644 --- a/miku/plugins/twitter.lua +++ b/miku/plugins/twitter.lua @@ -50,6 +50,7 @@ function get_tweet(response) end local header = 'Tweet von '..full_name..' (@' ..user_name..''..verified..'):' local text = response.full_text + local tweet_link = '\nTweet aufrufen' -- favorites & retweets if response.retweet_count == 0 then @@ -63,11 +64,11 @@ function get_tweet(response) favorites = response.favorite_count..'x favorisiert' end if retweets == "" and favorites ~= "" then - footer = ''..favorites..'' + footer = '\n'..favorites..'' elseif retweets ~= "" and favorites == "" then - footer = ''..retweets..'' + footer = '\n'..retweets..'' elseif retweets ~= "" and favorites ~= "" then - footer = ''..retweets..' - '..favorites..'' + footer = '\n'..retweets..' - '..favorites..'' else footer = "" end @@ -138,7 +139,7 @@ function get_tweet(response) text = text..'\n\n'..quote..'\n' end - return header.."\n"..utilities.trim(text).."\n"..footer, images, videos + return header.."\n"..utilities.trim(text)..footer..tweet_link, images, videos end function twitter:action(msg, config, matches)