Sha256: 4858e54652f8117b7403dfe254ade25f53b994439b6e759e9a3f1a651d173c48

Contents?: true

Size: 1.07 KB

Versions: 7

Compression:

Stored size: 1.07 KB

Contents

require_relative '../rest/rest'
require_relative '../streaming/streaming'
require_relative '../bot'

module Elephrame
  module Bots
    
    ##
    # a bot that posts things on an interval but can also respond
    # to interactions
    #
    # requires on_* variables to be set before running, otherwise the bot
    # won't react to interactions
    
    class PeriodInteract < BaseBot
      include Elephrame::Streaming
      include Elephrame::Scheduler
      include Elephrame::AllInteractions

      ##
      # creates a new PeriodInteract bot
      #
      # @param intv [String] string specifying interval to post
      #
      # @return [Elephrame::Bots::PeriodInteract]
      
      def initialize intv
        super()
        
        setup_scheduler intv
        setup_streaming
      end

      ##
      # Runs the bot. requires a block for periodic post logic, but relies on
      # on_* functions for interaction logic. See Elephrame::AllInteractions
      # for more details.
      
      def run
        run_scheduled &Proc.new
        run_interact
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
elephrame-0.4.5 lib/elephrame/mix/bots.rb
elephrame-0.4.4 lib/elephrame/mix/bots.rb
elephrame-0.4.3 lib/elephrame/mix/bots.rb
elephrame-0.4.2 lib/elephrame/mix/bots.rb
elephrame-0.4.1 lib/elephrame/mix/bots.rb
elephrame-0.4.0 lib/elephrame/mix/bots.rb
elephrame-0.3.7 lib/elephrame/mix/bots.rb