tcpbot/plugins/CodeView.rb
oz 3a2fb94b1f there was some weird stuff going on with PlugTool, but it's fixed.
also added coreload to dynplug to reload all the core files!
oh and the pastebin plugin was renamed so as not to conflict
  with the pastebin gem in use by Artism
2021-05-30 04:54:54 -05:00

31 lines
781 B
Ruby

require 'cinch'
require 'open-uri'
require_relative '../classes/Util.rb'
class CodeView
include Cinch::Plugin
include Hooks::ACLHook
include Util::PluginHelper
set :prefix, /^:/
@clist = %w{paste}
@@commands["paste"] = ":paste <plugname> - output plugin source to pastebin"
@@levelRequired = 10
match /paste ([a-zA-Z][a-zA-Z0-9]+)/, method: :pastebin;
def pastebin(m, modname)
response = "#{m.user.nick}: "
if(!aclcheck(m))
response << "your access level is not high enough for this command."
end
path = "./plugins/#{modname}.rb"
if(File.exist?(path))
response << IO.popen("pastebin -f #{path} -l ruby -n '#{modname} src'").readlines.pop
else
response << "#{modname} not found..."
end
m.reply response
end
end