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