summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-09-15 00:05:23 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-09-15 00:23:47 +0200
commit8bcbbc0c3225b09b1c0f20c2974f95f38db333ec (patch)
tree8dae246fca10720004d760ae6f4a6ad99e79be81
parent9ed8ad84aa87a414319ffea22b4ffc3cee5e53bf (diff)
twitter: warn about failed authorization
Fly-by whitespace cleanups too.
-rw-r--r--data/rbot/plugins/twitter.rb13
1 files changed, 9 insertions, 4 deletions
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 <pin>' to finish authorization: " + @request_token.authorize_url
end