-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
43 lines (35 loc) · 1.06 KB
/
Copy pathRakefile
File metadata and controls
43 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
require 'rake'
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
STDERR.puts 'RSpec not installed. This is probably ok.'
end
task :default => :spec
task :run do
require File.dirname(__FILE__) + '/lib/yobot'
login = ENV['CAMPFIRE_LOGIN']
password = ENV['CAMPFIRE_PASSWORD']
subdomain = ENV['CAMPFIRE_SUBDOMAIN']
conn = Firering::Connection.new("http://#{subdomain}.campfirenow.com") do |c|
c.login = login
c.password = password
c.max_retries = 10 # default to -1, which means perform connection retries on drop forever.
end
bot = Yobot::Bot.new [Yobot::Behaviors::PingPong.new, Yobot::Behaviors::Dict.new, Yobot::Behaviors::Anaveda.new]
EM.run do
conn.authenticate do |user|
conn.rooms do |rooms|
rooms.each do |room|
room.text('Hello World') {}
room.stream do |message|
if message.type == 'TextMessage'
bot.received_message room, message.body
end
end
end
end
end
trap("INT") { EM.stop }
end
end