Module: Hibot
- Extended by:
- Configuration
- Defined in:
- lib/hibot.rb,
lib/hibot/plugins/giphy.rb,
lib/hibot/plugins/spotify.rb
Defined Under Namespace
Class Method Summary collapse
Methods included from Configuration
config_file_exists?, configure, configure_hibot_giphy, configure_hibot_spotify, read_config_file
Class Method Details
.launch(opts) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hibot.rb', line 16 def self.launch(opts) # Read the config file and get all the settings in the config hash config = self.configure(opts) bot = Cinch::Bot.new do configure do |c| # General bot settings such server, channels etc config[:general].each {|opt, value| c.send("#{opt}=".to_sym, value) } # Load plugins c.plugins.plugins = [] config[:general]['plugins.plugins'.to_sym].each do |plugin| c.plugins.plugins << Object.const_get(plugin) end end on :connect do |m| User('nickserv').send("IDENTIFY #{config[:general][:nick]} #{config[:general][:pass]}") end end # Loop to configure each activated plugins config[:general]['plugins.plugins'.to_sym].each do |plugin| # Format the plugin name to call the appropriate configure method plugin_name = plugin.split('::').join('_').downcase self.send("configure_#{plugin_name}", config[plugin.to_sym]) end bot.start end |