Revision 0b67cab8
Added by Marc Dequènes about 13 years ago
- ID 0b67cab83c4ab4f6190a0f8955489efc02a60f0c
lib/cyborghood/cyborg.rb | ||
---|---|---|
#++
|
||
|
||
require 'cyborghood'
|
||
require 'socket'
|
||
require 'eventmachine'
|
||
require 'thread'
|
||
require 'cyborghood/cyborg/dsl'
|
||
... | ... | |
end
|
||
|
||
class Cyborg
|
||
include I18nTranslation
|
||
bindtextdomain("cyborghood", {:path => Config::L10N_DIR, :charset => "UTF-8"})
|
||
|
||
include TaskAspect
|
||
|
||
attr_reader :name, :services
|
||
attr_reader :name, :services, :host_name, :host_fqdn
|
||
|
||
def initialize(services = nil)
|
||
@services = services
|
||
|
||
@name = self.class.name.split("::").last
|
||
@host_name = Socket.gethostname
|
||
@host_fqdn = Socket.gethostbyname(Socket.gethostname).first
|
||
@name = "#{self.class.model}@#{@host_fqdn}"
|
||
|
||
@config = Config.instance
|
||
|
||
# setup logs
|
||
... | ... | |
logger.info "Bot '#{self.human_name}' loaded"
|
||
end
|
||
|
||
def self.model
|
||
self.human_name
|
||
end
|
||
|
||
def model
|
||
self.class.model
|
||
end
|
||
|
||
# #^.*/system$# categories are reserved
|
||
# but you may enhance or break the system as you wish
|
||
def get_channel(name)
|
Also available in: Unified diff
[evol] introduce Cyborg model and compute the name using the model and host fqdn