Module: Ocelots::Bot

Includes:
Ocelots
Defined in:
lib/ocelots/bot.rb

Instance Method Summary collapse

Methods included from Ocelots

#base_url, #get, #post, #post_antechamber, #request_antechamber, #request_profile, #url_for

Instance Method Details

#execute(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ocelots/bot.rb', line 7

def execute *args
  RiplWatir
  bot = Cinch::Bot.new do
    configure do |c|
      c.nick = args.shift
      c.server = args.shift
      c.port = args.shift.to_i
      c.channels = args
    end

    on :message, /^phone for (.+)$/ do |m, text|
      visit_page(:gab).search text
      phone = on_page(:gab).phone
      if phone
        m.reply "phone for #{text} is #{phone}"
      else
        m.reply "couldn't find a phone number for #{text} sorry"
      end
    end
  end
  bot.start
end