diff --git a/classes/Forget.rb b/classes/Forget.rb index 13eefdd7..b8e61ba9 100644 --- a/classes/Forget.rb +++ b/classes/Forget.rb @@ -18,7 +18,7 @@ class Forget end ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot plug = Kernel.const_get(modname) - require "/var/src/ruby/extendobot/plugins/#{modname}.rb" + require "./plugins/#{modname}.rb" ibot.plugins.unregister_plugin(plug) m.reply("#{modname} forgotten successfully") end diff --git a/classes/Util.rb b/classes/Util.rb index d90268c5..a6f9de85 100644 --- a/classes/Util.rb +++ b/classes/Util.rb @@ -180,7 +180,7 @@ module Util } c.channels = cList pList = Array.new - Pathname.glob("/var/src/ruby/extendobot/plugins/*.rb").each { |plugin| + Pathname.glob("./plugins/*.rb").each { |plugin| puts "found plugin #{plugin}" load plugin diff --git a/plugins/DynPlug.rb b/plugins/DynPlug.rb index bbf8f514..1e69d3c8 100644 --- a/plugins/DynPlug.rb +++ b/plugins/DynPlug.rb @@ -25,7 +25,7 @@ class DynPlug return end begin - if(File.exist?("/var/src/ruby/extendobot/plugins/#{modname}.rb")) + if(File.exist?("./plugins/#{modname}.rb")) m.reply("plugin with name #{modname} already exists") return false; end @@ -34,21 +34,21 @@ class DynPlug open(url) do |f| content = f.read content.gsub!(%r{]+?>}, '') - open("/var/src/ruby/extendobot/plugins/#{modname}.rb", "w") do |plugin| + open("./plugins/#{modname}.rb", "w") do |plugin| plugin.write content end end rescue Exception => error m.user.send("Error downloading #{modname}: #{error}") end - load "/var/src/ruby/extendobot/plugins/#{modname}.rb"; + load "./plugins/#{modname}.rb"; ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot ibot.plugins.register_plugin(Object.const_get(modname)) m.reply("#{modname} added successfully") rescue Exception => error m.user.send "Error loading #{modname}: #{error}" m.reply "Error loading, deleting downloaded module. Check privmsg for details" - m.user.send "#{modname}.rb deleted" if File.unlink "/var/src/ruby/extendobot/plugins/#{modname}.rb" + m.user.send "#{modname}.rb deleted" if File.unlink "./plugins/#{modname}.rb" end end @@ -67,7 +67,7 @@ class DynPlug m.reply("#{m.user.nick}: your access level is not high enough for this command.") return end - if(File.exist?("/var/src/ruby/extendobot/plugins/#{modname}.rb")) + if(File.exist?("./plugins/#{modname}.rb")) ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot i = ibot.plugins.find_index { |x| x.class == Kernel.const_get(modname) } @@ -88,14 +88,14 @@ class DynPlug m.reply("#{m.user.nick}: your access level is not high enough for this command.") return end - if(File.exist?("/var/src/ruby/extendobot/plugins/#{modname}.rb")) + if(File.exist?("./plugins/#{modname}.rb")) ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot i = ibot.plugins.find_index { |x| x.class == modname } if(i != nil) m.reply("#{modname} already loaded; try :reload instead") else begin - load "/var/src/ruby/extendobot/plugins/#{modname}.rb" + load "./plugins/#{modname}.rb" rescue Exception => error m.reply "Error loading #{modname}. check privmsg for details" m.user.send "Error loading #{modname}: #{error}" diff --git a/plugins/Pastebin.rb b/plugins/Pastebin.rb index 6dcabf3e..a7b97ec3 100644 --- a/plugins/Pastebin.rb +++ b/plugins/Pastebin.rb @@ -17,7 +17,7 @@ class Pastebin m.reply("#{m.user.nick}: your access level is not high enough for this command.") return end - path = "/var/src/ruby/extendobot/plugins/#{modname}.rb" + path = "./plugins/#{modname}.rb" if(File.exist?(path)) IO.popen("pastebin -f #{path} -l ruby -n '#{modname} src'").readlines.each { |line| m.reply line } else diff --git a/plugins/PlugTool.rb b/plugins/PlugTool.rb index fdda7b98..560a1f4f 100644 --- a/plugins/PlugTool.rb +++ b/plugins/PlugTool.rb @@ -27,7 +27,7 @@ class PlugTool def plugs(m, opt) debug "in plugs, got opt as #{opt.to_s}" plugs = Hash.new - Pathname.glob("/var/src/ruby/extendobot/plugins/*.rb").each { |plugin| + Pathname.glob("./plugins/*.rb").each { |plugin| plugname = File.basename(plugin.basename,File.extname(plugin)) plugs[plugname] = Hash.new plugs[plugname]["enabled"] = m.bot.config.plugins.plugins.include? Object.const_get plugname @@ -54,7 +54,7 @@ class PlugTool if(modname != nil) puts modname modname.strip! - if(File.exist?("/var/src/ruby/extendobot/plugins/#{modname}.rb")) + if(File.exist?("./plugins/#{modname}.rb")) ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot kc = Kernel.const_get(modname)