lib/twitter_ebooks/bot.rb
# Configures client and fires startup event
Configures client and fires startup event
Configures client and fires startup event
def prepare
      if @username.nil?
        raise ConfigurationError, "bot username cannot be nil"
      end
      if @consumer_key.nil? || @consumer_key.empty? ||
         @consumer_secret.nil? || @consumer_key.empty?
        log "Missing consumer_key or consumer_secret. These details can be acquired by registering a Twitter app at https://apps.twitter.com/"
        exit 1
      end
      if @access_token.nil? || @access_token.empty? ||
         @access_token_secret.nil? || @access_token_secret.empty?
        log "Missing access_token or access_token_secret. Please run `ebooks auth`."
        exit 1
      end
      real_name = twitter.user.screen_name
      if real_name != @username
        log "connected to @#{real_name}-- please update config to match Twitter account name"
        @username = real_name
      end
      fire(:startup)
    end
def prepare if @username . nil? raise ConfigurationError , "bot username cannot be nil" end if @consumer_key . nil? || @consumer_key . empty? || @consumer_secret . nil? || @consumer_key . empty? log "Missing consumer_key or consumer_secret. These details can be acquired by registering a Twitter app at https://apps.twitter.com/" exit 1 end if @access_token . nil? || @access_token . empty? || @access_token_secret . nil? || @access_token_secret . empty? log "Missing access_token or access_token_secret. Please run `ebooks auth`." exit 1 end real_name = twitter . user . screen_name if real_name != @username log "connected to @#{real_name}-- please update config to match Twitter account name" @username = real_name end fire ( :startup ) end
Configures client and fires startup event
Configures client and fires startup event
# Sanity check