tcpbot/plugins/PrivMsg.rb

26 lines
674 B
Ruby

require 'cinch'
require_relative '../classes/Util.rb'
class PrivMsg
include Cinch::Plugin
include Hooks::ACLHook
include Util::PluginHelper
set :prefix, /^:/
@@levelRequired = 10
match /msg (\#?.+?) (.+)$/, method: :msg
def msg(m, target, words)
puts "\ttarget: #{target}\nwords: #{words}\n\n\n"
return unless aclcheck(m)
to = Target(target)
if(target.match /^\#/) # target is channel
puts "sending message to #{target} as chamel"
#to = Channel(target)
else
puts "treating #{target} as a nick"
#to = User(target)
end
puts "target.to: #{to.inspect}\n"*6
to.send(words)
end
end