Revision 4d9f2962
Added by Marc Dequènes over 13 years ago
- ID 4d9f2962db882142ce63530d9b8844890bb557be
lib/cyborghood/cyborg.rb | ||
---|---|---|
logger.info "Bot starting"
|
||
EventMachine.run do
|
||
start_work
|
||
try_stop
|
||
end
|
||
rescue EventMachine::ConnectionNotBound
|
||
logger.fatal "Internal error (EventMachine::ConnectionNotBound)"
|
||
... | ... | |
end
|
||
|
||
def ready_to_stop?
|
||
true
|
||
DSL::Task.idle?
|
||
end
|
||
|
||
def stop
|
||
... | ... | |
[]
|
||
end
|
||
|
||
def task(name, &block)
|
||
DSL::Task.new(self, name, &block)
|
||
end
|
||
|
||
def schedule_task(callback, &task)
|
||
EventMachine.defer(task, callback)
|
||
end
|
Also available in: Unified diff
[evol] Task-based client DSL §4 (many fixes, helper, bot stop condition, more logging)