|
# File rbot/keywords.rb, line 288
def keyword_command(sourcenick, target, lhs, mhs, rhs, quiet=false)
debug "got keyword command #{lhs}, #{mhs}, #{rhs}"
overwrite = false
overwrite = true if(lhs.gsub!(/^no,\s*/, ""))
also = true if(rhs.gsub!(/^also\s+/, ""))
values = rhs.split(/\s+\|\s+/)
lhs = Keyword.unescape lhs
if(overwrite || also || !has_key?(lhs))
if(also && has_key?(lhs))
kw = self[lhs]
kw << values
@keywords[lhs] = kw.dump
else
@keywords[lhs] = Keyword.new(mhs, values).dump
end
@bot.okay target if !quiet
elsif(has_key?(lhs))
kw = self[lhs]
@bot.say target, "but #{lhs} #{kw.type} #{kw.desc}" if kw && !quiet
end
end
|