From e5c90923340a0504e8e9730bddbda0a1703638ea Mon Sep 17 00:00:00 2001 From: moguno Date: Sun, 8 Jun 2014 10:32:48 +0900 Subject: [PATCH] =?UTF-8?q?=E8=AA=8D=E8=A8=BC=E3=81=AB=E5=A4=B1=E6=95=97?= =?UTF-8?q?=E3=81=97=E3=81=9F=E5=A0=B4=E5=90=88=E3=80=81=E5=86=8D=E8=AA=8D?= =?UTF-8?q?=E8=A8=BC=E3=81=A7=E7=84=A1=E5=8A=B9=E3=81=AAURL=E3=81=8C?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=82=8B=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/plugin/change_account/change_account.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/core/plugin/change_account/change_account.rb b/core/plugin/change_account/change_account.rb index 4e0d180..633d31e 100644 --- a/core/plugin/change_account/change_account.rb +++ b/core/plugin/change_account/change_account.rb @@ -86,12 +86,15 @@ Plugin.create :change_account do @sequence[:first].call end end end - def request_token - @request_token ||= parallel { - twitter = MikuTwitter.new - twitter.consumer_key = Environment::TWITTER_CONSUMER_KEY - twitter.consumer_secret = Environment::TWITTER_CONSUMER_SECRET - twitter.request_oauth_token } end + def request_token(reset = false) + if !@request_token || reset + @request_token = parallel { + twitter = MikuTwitter.new + twitter.consumer_key = Environment::TWITTER_CONSUMER_KEY + twitter.consumer_secret = Environment::TWITTER_CONSUMER_SECRET + twitter.request_oauth_token } end + + @request_token end defsequence :first do sequence. @@ -159,7 +162,7 @@ Plugin.create :change_account do false } sequence. - say(_("登録方法は、\n1. %{authorize_url} にアクセスする\n2. mikutterに登録したいTwitterアカウントでログイン\n3. 適当に進んでいって取得できる7桁のコードをこのウィンドウの一番上に入力\nだよ。") % {authorize_url: request_token.authorize_url}, nil) + say(_("登録方法は、\n1. %{authorize_url} にアクセスする\n2. mikutterに登録したいTwitterアカウントでログイン\n3. 適当に進んでいって取得できる7桁のコードをこのウィンドウの一番上に入力\nだよ。") % {authorize_url: request_token(true).authorize_url}, nil) end defsequence :achievement do -- 1.9.1