Revision 45333094
Added by Marc Dequènes over 13 years ago
- ID 4533309490bb30fb5b2827d0f1140afa339799bf
lib/cyborghood/cyborg.rb | ||
---|---|---|
include I18nTranslation
|
||
bindtextdomain("cyborghood", {:path => Config::L10N_DIR, :charset => "UTF-8"})
|
||
|
||
attr_reader :name
|
||
|
||
def initialize
|
||
@name = self.class.name.split("::").last
|
||
|
||
@config = Config.instance
|
||
@config.bot_id = self.class.name
|
||
|
||
# setup logs
|
||
unless @config.log.nil?
|
||
... | ... | |
EventMachine.run do
|
||
start_work
|
||
end
|
||
rescue EventMachine::ConnectionNotBound
|
||
logger.fatal "Internal error (EventMachine::ConnectionNotBound)"
|
||
end
|
||
|
||
def start_work
|
||
... | ... | |
|
||
def ask_to_stop
|
||
logger.info "Bot was asked to stop..."
|
||
stop
|
||
end
|
||
|
||
def stop
|
||
logger.info "Bot stopping"
|
||
EventMachine.stop
|
||
end
|
||
|
Also available in: Unified diff
[fix/evol] conversation/bot protocol rework §8 (refs #30)