|
# File rbot/keywords.rb, line 347
def privmsg(m)
if(m.address?)
if(!(m.message =~ /\\\?\s*$/) && m.message =~ /^(.*\S)\s*\?\s*$/)
keyword m, $1 if(@bot.auth.allow?("keyword", m.source, m.replyto))
elsif(m.message =~ /^(.*?)\s+(is|are)\s+(.*)$/)
keyword_command(m.sourcenick, m.replyto, $1, $2, $3) if(@bot.auth.allow?("keycmd", m.source, m.replyto))
elsif (m.message =~ /^tell\s+(\S+)\s+about\s+(.+)$/)
keyword_tell(m, $1, $2) if(@bot.auth.allow?("keyword", m.source, m.replyto))
elsif (m.message =~ /^forget\s+(.*)$/)
key = $1
if((@bot.auth.allow?("keycmd", m.source, m.replyto)) && @keywords.has_key?(key))
@keywords.delete(key)
@bot.okay m.replyto
end
elsif (m.message =~ /^keywords$/)
if(@bot.auth.allow?("keyword", m.source, m.replyto))
length = 0
@statickeywords.each {|k,v|
length += v.length
}
m.reply "There are currently #{@keywords.length} keywords, #{length} static facts defined."
end
end
else
# in channel message, not to me
if(m.message =~ /^'(.*)$/ || (@bot.config["NO_KEYWORD_ADDRESS"] == "true" && m.message =~ /^(.*\S)\s*\?\s*$/))
keyword m, $1, false if(@bot.auth.allow?("keyword", m.source))
elsif(@bot.config["KEYWORD_LISTEN"] == "true" && (m.message =~ /^(.*?)\s+(is|are)\s+(.*)$/))
# TODO MUCH more selective on what's allowed here
keyword_command(m.sourcenick, m.replyto, $1, $2, $3, true) if(@bot.auth.allow?("keycmd", m.source))
end
end
end
|