Sha256: 577d630868da9b9810aea30188ace14556eb8c19a757427602033a4b27598329

Contents?: true

Size: 822 Bytes

Versions: 3

Compression:

Stored size: 822 Bytes

Contents

require 'retryable'
require 'retrobot/tweet_filters/base'

class Retrobot
  module TweetFilters
    class Retweet < Base
      def initialize(retrobot)
        super
      end

      def filter(tweet)
        if tweet.retweeted_status_id
          if config.retweet
            retweet tweet.retweeted_status_id, tweet.text
          else
            logger.info "retweet (skipped): #{tweet.retweeted_status_id} \"#{tweet.text}\""
          end
          return nil
        else
          tweet
        end
      end

      private
      def retweet(status_id, text=nil)
        logger.info "retweet: #{status_id} \"#{text}\""
        return if config.dryrun
        Retryable.retryable(tries: config.retry_count, sleep: config.retry_interval) do
          client.retweet status_id
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
retrobot-0.3.5 lib/retrobot/tweet_filters/retweet.rb
retrobot-0.3.4 lib/retrobot/tweet_filters/retweet.rb
retrobot-0.3.3 lib/retrobot/tweet_filters/retweet.rb