Permalink
Browse files

Fixing issue with getting the name in plugins.

  • Loading branch information...
wilkie committed Feb 5, 2012
1 parent 041fd44 commit f5e74a71a8689b43f54011d3346d00034206ee91
Showing with 15 additions and 16 deletions.
  1. +15 −16 lib/xombot.rb
View
@@ -30,6 +30,11 @@ module XOmBot
class << self
attr_reader :plugins
+ attr_reader :name
+ attr_reader :server
+ attr_reader :channels
+ attr_reader :port
+ attr_reader :ssl
def add_plugin plugin
@plugins = [] if @plugins.nil?
@@ -39,32 +44,26 @@ def add_plugin plugin
def load_plugins
end
- def name
- NAME
- end
-
def start
config_path = "#{File.dirname(__FILE__)}/../config"
if not File.exists?("#{config_path}/config.yml")
FileUtils.cp("#{config_path}/config.yml.example", "#{config_path}/config.yml")
end
config = YAML.load(File.open("#{config_path}/config.yml"))
- puts config
- name = config["name"] || NAME
- server = config["server"] || SERVER
- port = config["port"] || PORT
- ssl = (config["ssl"] == "true") || SSL
- channels = config["channels"] || CHANNELS
- puts channels
+ @name = config["name"] || NAME
+ @server = config["server"] || SERVER
+ @port = config["port"] || PORT
+ @ssl = (config["ssl"] == "true") || SSL
+ @channels = config["channels"] || CHANNELS
bot = Cinch::Bot.new do
configure do |c|
- c.server = server
- c.port = port
- c.ssl.use = ssl
- c.nick = name
- c.channels = channels
+ c.server = @server
+ c.port = @port
+ c.ssl.use = @ssl
+ c.nick = @name
+ c.channels = @channels
c.plugins.plugins = XOmBot::Plugins.constants.map do |plugin|
XOmBot::Plugins.const_get(plugin)
end

0 comments on commit f5e74a7

Please sign in to comment.