Class: Hipbot::Bot
Instance Attribute Summary
Attributes included from Configurable
#configuration
Attributes included from Adapter
#connection
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Reactable
default, desc, on, scope
Methods included from Cache
#_cache
Methods included from Matchable
#react, #reactions
#initialize
Methods included from Adapter
#invite_to_room, #join_room, #kick_from_room, #leave_room, #restart!, #send_to_room, #send_to_user, #set_presence, #set_topic, #start!
Class Method Details
.on_exception(&block) ⇒ Object
40
41
42
|
# File 'lib/hipbot/bot.rb', line 40
def on_exception &block
instance.configuration.exception_handler = block
end
|
.on_preload(&block) ⇒ Object
36
37
38
|
# File 'lib/hipbot/bot.rb', line 36
def on_preload &block
instance.configuration.preloader = block
end
|
.start! ⇒ Object
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/hipbot/bot.rb', line 44
def start!
::EM.error_handler(&instance.configuration.exception_handler)
::EM.run do
instance.setup
begin
instance.start!
rescue Exception => e
instance_exec(e, &instance.configuration.exception_handler)
end
end
end
|
Instance Method Details
#setup ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/hipbot/bot.rb', line 24
def setup
Hipbot.bot = self
User.send(:include, storage)
Room.send(:include, storage)
Response.send(:include, helpers)
helpers.module_exec(&preloader)
plugins << self
end
|