def start
      check_config
      init_clients

      if $bot[:stream]
        puts "connecting to streaming APIs"

        @userstream_thread ||= Thread.new do
          loop do
            begin
              puts "connected to user stream"
              @streamer.user do |obj|
                handle_stream_object obj, :user
              end
            rescue => e
              puts "lost user stream connection: " + e.message
            end
            puts "reconnecting in #{Twittbot::RECONNECT_WAIT_TIME} seconds..."
            sleep Twittbot::RECONNECT_WAIT_TIME
          end
        end

        @tweetstream_thread ||= Thread.new do
          loop do
            begin
              puts "connected to tweet stream"
              @streamer.filter track: $bot[:config][:track].join(",") do |obj|
                handle_stream_object obj, :filter
              end
            rescue
              puts "lost tweet stream connection: " + e.message
            end
            puts "reconnecting in #{Twittbot::RECONNECT_WAIT_TIME} seconds..."
            sleep Twittbot::RECONNECT_WAIT_TIME
          end
        end
      end

      @periodic_thread ||= Thread.new do
        loop do
          begin
            Thread.new { do_periodic }
          rescue => _
          end
          sleep 60
        end
      end

      do_callbacks :load, nil

      if $bot[:stream]
        @userstream_thread.join
        @tweetstream_thread.join
      end
      @periodic_thread.join
    end
def start
      check_config
      init_clients

      if $bot[:stream]
        puts "connecting to streaming APIs"

        @userstream_thread ||= Thread.new do
          loop do
            begin
              puts "connected to user stream"
              @streamer.user do |obj|
                handle_stream_object obj, :user
              end
            rescue => e
              puts "lost user stream connection: " + e.message
            end
            puts "reconnecting in #{Twittbot::RECONNECT_WAIT_TIME} seconds..."
            sleep Twittbot::RECONNECT_WAIT_TIME
          end
        end

        @tweetstream_thread ||= Thread.new do
          loop do
            begin
              puts "connected to tweet stream"
              @streamer.filter track: $bot[:config][:track].join(",") do |obj|
                handle_stream_object obj, :filter
              end
            rescue
              puts "lost tweet stream connection: " + e.message
            end
            puts "reconnecting in #{Twittbot::RECONNECT_WAIT_TIME} seconds..."
            sleep Twittbot::RECONNECT_WAIT_TIME
          end
        end
      end

      @periodic_thread ||= Thread.new do
        loop do
          begin
            Thread.new { do_periodic }
          rescue => _
          end
          sleep 60
        end
      end

      do_callbacks :load, nil

      if $bot[:stream]
        @userstream_thread.join
        @tweetstream_thread.join
      end
      @periodic_thread.join
    end
Starts the bot.