From 8bcbbc0c3225b09b1c0f20c2974f95f38db333ec Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 15 Sep 2010 00:05:23 +0200 Subject: twitter: warn about failed authorization Fly-by whitespace cleanups too. --- data/rbot/plugins/twitter.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index 1c8f61dd..753a0e45 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -192,14 +192,19 @@ class TwitterPlugin < Plugin return false end - @consumer = OAuth::Consumer.new(key, secret, { + @consumer = OAuth::Consumer.new(key, secret, { :site => "https://api.twitter.com", :request_token_path => "/oauth/request_token", :access_token_path => "/oauth/access_token", :authorize_path => "/oauth/authorize" - } ) - @request_token = @consumer.get_request_token - @registry[m.sourcenick + "_request_token"] = YAML::dump(@request_token) + } ) + begin + @request_token = @consumer.get_request_token + rescue OAuth::Unauthorized + m.reply _("My authorization failed! Did you block me? Or is my Twitter Consumer Key/Secret pair incorrect?") + return false + end + @registry[m.sourcenick + "_request_token"] = YAML::dump(@request_token) m.reply "Go to this URL to get your authorization PIN, then use 'twitter pin ' to finish authorization: " + @request_token.authorize_url end -- cgit v1.2.3