|
# File rbot/keywords.rb, line 84
def initialize(bot)
@bot = bot
@statickeywords = Hash.new
@keywords = DBHash.new bot, "keywords"
scan
# import old format keywords into DBHash
if(File.exist?("#{@bot.botclass}/keywords.rbot"))
puts "auto importing old keywords.rbot"
IO.foreach("#{@bot.botclass}/keywords.rbot") do |line|
if(line =~ /^(.*?)\s*<=(is|are)?=?>\s*(.*)$/)
lhs = $1
mhs = $2
rhs = $3
mhs = "is" unless mhs
rhs = Keyword.escape rhs
values = rhs.split("<=or=>")
@keywords[lhs] = Keyword.new(mhs, values).dump
end
end
File.delete("#{@bot.botclass}/keywords.rbot")
end
end
|