Sha256: 0e36b4011fc0e634ca1fa7a3f72d48d208d957f16a64bcf42eed61220e08a58b

Contents?: true

Size: 812 Bytes

Versions: 3

Compression:

Stored size: 812 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(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.2 lib/retrobot/tweet_filters/retweet.rb
retrobot-0.3.1 lib/retrobot/tweet_filters/retweet.rb
retrobot-0.3.0 lib/retrobot/tweet_filters/retweet.rb