Merge branch 'master' of github.com:Brawl345/Brawlbot-v2

This commit is contained in:
Andreas Bielawski 2016-07-16 13:10:33 +02:00
commit c05029b305

View File

@ -27,7 +27,8 @@ function twitter:init(config)
end end
twitter.triggers = { twitter.triggers = {
'twitter.com/[^/]+/statuse?s?/([0-9]+)' 'twitter.com/[^/]+/statuse?s?/([0-9]+)',
'twitter.com/statuse?s?/([0-9]+)'
} }
twitter.doc = [[*Twitter-Link*: Postet Tweet]] twitter.doc = [[*Twitter-Link*: Postet Tweet]]
end end
@ -46,12 +47,13 @@ local client = OAuth.new(consumer_key, consumer_secret, {
OAuthTokenSecret = access_token_secret OAuthTokenSecret = access_token_secret
}) })
function twitter:action(msg) function twitter:action(msg, config, matches)
if not msg.text:match('twitter.com/[^/]+/statuse?s?/([0-9]+)') then if not matches[2] then
return id = matches[1]
else
id = matches[2]
end end
local id = msg.text:match('twitter.com/[^/]+/statuse?s?/([0-9]+)')
local twitter_url = "https://api.twitter.com/1.1/statuses/show/" .. id.. ".json" local twitter_url = "https://api.twitter.com/1.1/statuses/show/" .. id.. ".json"
local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url) local response_code, response_headers, response_status_line, response_body = client:PerformRequest("GET", twitter_url)