Class: Elephrame::Bots::PeriodInteract

Inherits:
BaseBot
  • Object
show all
Includes:
AllInteractions, Scheduler, Streaming
Defined in:
lib/elephrame/mix/bots.rb

Overview

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

Constant Summary

Constants inherited from BaseBot

BaseBot::FNGabLink, BaseBot::NoBotRegex

Instance Attribute Summary

Attributes included from AllInteractions

#on_boost, #on_fave, #on_follow

Attributes included from Reply

#on_reply

Attributes included from Scheduler

#schedule, #scheduler

Attributes included from Streaming

#streamer

Attributes inherited from BaseBot

#client, #failed, #max_retries, #strip_html, #username

Instance Method Summary collapse

Methods included from AllInteractions

#run_interact

Methods included from Reply

#reply, #reply_with_mentions, #run_reply

Methods included from Scheduler

#run_scheduled, #setup_scheduler

Methods included from Streaming

#setup_streaming

Methods inherited from BaseBot

backup_method, #fetch_account_id, #fetch_list_id, #find_ancestor, #no_bot?, #post

Constructor Details

#initialize(intv) ⇒ Elephrame::Bots::PeriodInteract

creates a new PeriodInteract bot

Parameters:

  • intv (String)

    string specifying interval to post



29
30
31
32
33
34
# File 'lib/elephrame/mix/bots.rb', line 29

def initialize intv
  super()
  
  setup_scheduler intv
  setup_streaming
end

Instance Method Details

#runObject

Runs the bot. requires a block for periodic post logic, but relies on on_* functions for interaction logic. See Elephrame::AllInteractions for more details.



41
42
43
44
# File 'lib/elephrame/mix/bots.rb', line 41

def run
  run_scheduled &Proc.new
  run_interact
end