Revision bc642412
Added by Marc Dequènes over 13 years ago
- ID bc642412b31c7f4a3066a649cd06cc2a0acc4b8b
lib/cyborghood/cyborg.rb | ||
---|---|---|
#++
|
||
|
||
require 'cyborghood'
|
||
require 'eventmachine'
|
||
|
||
|
||
module CyborgHood
|
||
... | ... | |
|
||
def run
|
||
logger.info "Bot starting"
|
||
EventMachine.run do
|
||
start_work
|
||
end
|
||
end
|
||
|
||
def start_work
|
||
# use "aspects" Modules to define behaviors
|
||
end
|
||
|
||
def ask_to_stop
|
||
logger.info "Bot was asked to stop..."
|
||
EventMachine.stop
|
||
end
|
||
|
||
# core capabilities
|
||
def capabilities
|
||
[]
|
||
end
|
||
|
||
def schedule_task(callback, &task)
|
||
EventMachine.defer(task, callback)
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] moved EM loop in Cyborg, simplified and enhanced bot interface, and made Conversation common for any connection type