Method: Chatterbot::UI#get_oauth_verifier

Defined in:
lib/chatterbot/ui.rb

#get_oauth_verifierObject

print out a message about getting a PIN from twitter, then output the URL the user needs to visit to authorize



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/chatterbot/ui.rb', line 30

def get_oauth_verifier
  green "****************************************"
  green "****************************************"
  green "****        BOT AUTH TIME!          ****"
  green "****************************************"
  green "****************************************"      

  puts "You need to authorize your bot with Twitter.\n\nPlease login to Twitter under the bot's account. When you're ready, hit Enter.\n\nYour browser will open with the following URL, where you can authorize the bot.\n\n"

  url = request_token.authorize_url

  puts url

  puts "\nIf that doesn't work, you can open the URL in your browser manually."

  puts "\n\nHit enter to start.\n\n"
  
  STDIN.readline.chomp
  
  Launchy.open(url)

  # sleep here so that if launchy has any output (which it does
  # sometimes), it doesn't interfere with our input prompt
 
  sleep(2)

  puts "Paste your PIN and hit enter when you have completed authorization.\n\n"
  print "> "

  STDIN.readline.chomp.strip
rescue Interrupt => e
  exit
end