fixing path to source
This commit is contained in:
parent
ea30d13464
commit
5aba27d95b
@ -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
|
||||
|
@ -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
|
||||
|
@ -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}"
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user