370: def run()
371: $stdout.sync = true
372: puts _("First time rbot configuration wizard")
373: puts "===================================="
374: puts _("This is the first time you have run rbot with a config directory of: #{@bot.botclass}")
375: puts _("This wizard will ask you a few questions to get you started.")
376: puts _("The rest of rbot's configuration can be manipulated via IRC once rbot is connected and you are auth'd.")
377: puts "-----------------------------------"
378:
379: return unless @questions
380: @questions.sort{|a,b| a.order <=> b.order }.each do |q|
381: puts _(q.desc)
382: begin
383: print q.key.to_s + " [#{q.to_s}]: "
384: response = STDIN.gets
385: response.chop!
386: unless response.empty?
387: q.set_string response, false
388: end
389: puts _("configured #{q.key} => #{q.to_s}")
390: puts "-----------------------------------"
391: rescue ArgumentError => e
392: puts _("failed to set #{q.key}: #{e.message}")
393: retry
394: end
395: end
396: end