Class: CrazyDoll::Bot
- Inherits:
-
Object
- Object
- CrazyDoll::Bot
- Defined in:
- lib/crazy_doll/bot.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#event_manager ⇒ Object
readonly
Returns the value of attribute event_manager.
-
#irc ⇒ Object
readonly
Returns the value of attribute irc.
-
#plugin_manager ⇒ Object
readonly
Returns the value of attribute plugin_manager.
Instance Method Summary collapse
-
#initialize(config = nil) ⇒ Bot
constructor
A new instance of Bot.
- #start ⇒ Object
Constructor Details
#initialize(config = nil) ⇒ Bot
Returns a new instance of Bot.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/crazy_doll/bot.rb', line 5 def initialize(config=nil) @config = config || CrazyDoll::Config.new('yaml', File.join(ENV['HOME'], '.crazy_doll','database.yaml')) core_config = @config.config_of 'Core' @irc = CrazyDoll::IRC.new(core_config.server, core_config.port) @event_manager = CrazyDoll::EventManager.new(@irc) @plugin_manager = CrazyDoll::PluginManager @plugin_manager.load_plugins @plugin_manager.find_usable_errors @plugin_manager.register_plugins(@event_manager, @config) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
4 5 6 |
# File 'lib/crazy_doll/bot.rb', line 4 def config @config end |
#event_manager ⇒ Object (readonly)
Returns the value of attribute event_manager.
4 5 6 |
# File 'lib/crazy_doll/bot.rb', line 4 def event_manager @event_manager end |
#irc ⇒ Object (readonly)
Returns the value of attribute irc.
4 5 6 |
# File 'lib/crazy_doll/bot.rb', line 4 def irc @irc end |
#plugin_manager ⇒ Object (readonly)
Returns the value of attribute plugin_manager.
4 5 6 |
# File 'lib/crazy_doll/bot.rb', line 4 def plugin_manager @plugin_manager end |
Instance Method Details
#start ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/crazy_doll/bot.rb', line 16 def start @config.start_use begin @irc.start ensure @config.end_use end end |