lib/chatterbot/ui.rb
def get_api_key
      
      green "****************************************"
      green "****************************************"
      green "****        API SETUP TIME!         ****"
      green "****************************************"
      green "****************************************"      


      puts "\n\nWelcome to Chatterbot. Let's walk through the steps to get a bot running.\n\n"


      #
      # At this point, we don't have any API credentials at all for
      # this bot, but it's possible the user has already setup an app.
      # Let's ask!
      #
      
      puts "Hey, looks like you need to get an API key from Twitter before you can get started.\n\n"
      
      app_already_exists = ask_yes_no("Have you already set up an app with Twitter?")

      if app_already_exists
        puts "Terrific! Let's get your bot running!\n\n"
      else
        puts "OK, I can help with that!\n\n"
        send_to_app_creation
      end

      
      print "\n\nPaste the 'Consumer Key' here: "
      STDOUT.flush
      config[:consumer_key] = STDIN.readline.chomp.strip

      print "Paste the 'Consumer Secret' here: "
      STDOUT.flush
      config[:consumer_secret] = STDIN.readline.chomp.strip


      puts "\n\nNow it's time to authorize your bot!\n\n"
      
      if ! app_already_exists && ask_yes_no("Do you want to authorize a bot using the account that created the app?")
        puts "OK, on the app page, you can click the 'Create my access token' button to proceed.\n\n"

        print "Paste the 'Access Token' here: "
        STDOUT.flush
        config[:access_token] = STDIN.readline.chomp.strip


        print "\n\nPaste the 'Access Token Secret' here: "
        STDOUT.flush
        config[:access_token_secret] = STDIN.readline.chomp.strip

      
        # reset the client so we can re-init with new OAuth credentials
        reset_client

        # at this point we should have a fully validated client, so grab
        # the screen name
        @screen_name = client.user.screen_name rescue nil
      else
        reset_client
      end
        
      
      #
      # capture ctrl-c and exit without a stack trace
      #
    rescue Interrupt => e
      exit
    end
def get_api_key
      
      green "****************************************"
      green "****************************************"
      green "****        API SETUP TIME!         ****"
      green "****************************************"
      green "****************************************"      


      puts "\n\nWelcome to Chatterbot. Let's walk through the steps to get a bot running.\n\n"


      #
      # At this point, we don't have any API credentials at all for
      # this bot, but it's possible the user has already setup an app.
      # Let's ask!
      #
      
      puts "Hey, looks like you need to get an API key from Twitter before you can get started.\n\n"
      
      app_already_exists = ask_yes_no("Have you already set up an app with Twitter?")

      if app_already_exists
        puts "Terrific! Let's get your bot running!\n\n"
      else
        puts "OK, I can help with that!\n\n"
        send_to_app_creation
      end

      
      print "\n\nPaste the 'Consumer Key' here: "
      STDOUT.flush
      config[:consumer_key] = STDIN.readline.chomp.strip

      print "Paste the 'Consumer Secret' here: "
      STDOUT.flush
      config[:consumer_secret] = STDIN.readline.chomp.strip


      puts "\n\nNow it's time to authorize your bot!\n\n"
      
      if ! app_already_exists && ask_yes_no("Do you want to authorize a bot using the account that created the app?")
        puts "OK, on the app page, you can click the 'Create my access token' button to proceed.\n\n"

        print "Paste the 'Access Token' here: "
        STDOUT.flush
        config[:access_token] = STDIN.readline.chomp.strip


        print "\n\nPaste the 'Access Token Secret' here: "
        STDOUT.flush
        config[:access_token_secret] = STDIN.readline.chomp.strip

      
        # reset the client so we can re-init with new OAuth credentials
        reset_client

        # at this point we should have a fully validated client, so grab
        # the screen name
        @screen_name = client.user.screen_name rescue nil
      else
        reset_client
      end
        
      
      #
      # capture ctrl-c and exit without a stack trace
      #
    rescue Interrupt => e
      exit
    end
Ask the user to get an API key from Twitter.