- Dir.mkdir("#{@bot.botclass}/quotes") if(!FileTest.directory?("#{@bot.botclass}/quotes"))
- @lists.each {|channel, quotes|
- begin
- if @changed[channel]
- debug "Writing new quotefile for channel #{channel} ..."
- Utils.safe_save("#{@bot.botclass}/quotes/#{channel}") {|file|
- quotes.compact.each {|q|
- file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}"
- }
- }
- @changed[channel] = false
- else
- debug "Not writing quotefile for channel #{channel} (unchanged)"
- end
- rescue => e
- error "failed to write quotefile for channel #{channel}!\n#{$!}"
- error "#{e.class}: #{e}"
- error e.backtrace.join("\n")
- end
- }