twitter.lua: Sende Tweetlink mit (für twet.lua eig)
tweet.lua: Übersetzung rss.lua: cleanRSS
This commit is contained in:
parent
d43232777e
commit
a04abbcc50
@ -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%]', '')
|
||||
|
@ -6,26 +6,26 @@ tweet.command = 'tweet <Name>'
|
||||
|
||||
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* _<Name>_: 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)
|
||||
|
@ -50,6 +50,7 @@ function get_tweet(response)
|
||||
end
|
||||
local header = '<b>Tweet von '..full_name..'</b> (<a href="https://twitter.com/'..user_name..'">@' ..user_name..'</a>'..verified..'):'
|
||||
local text = response.full_text
|
||||
local tweet_link = '\n<a href= "https://twitter.com/statuses/'..response.id_str..'">Tweet aufrufen</a>'
|
||||
|
||||
-- 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 = '<i>'..favorites..'</i>'
|
||||
footer = '\n<i>'..favorites..'</i>'
|
||||
elseif retweets ~= "" and favorites == "" then
|
||||
footer = '<i>'..retweets..'</i>'
|
||||
footer = '\n<i>'..retweets..'</i>'
|
||||
elseif retweets ~= "" and favorites ~= "" then
|
||||
footer = '<i>'..retweets..' - '..favorites..'</i>'
|
||||
footer = '\n<i>'..retweets..' - '..favorites..'</i>'
|
||||
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)
|
||||
|
Reference in New Issue
Block a user