Class: Jambots::Controllers::NewController

Inherits:
Object
  • Object
show all
Defined in:
lib/jambots/controllers/new_controller.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ NewController

Returns a new instance of NewController.



6
7
8
# File 'lib/jambots/controllers/new_controller.rb', line 6

def initialize(options)
  @options = options
end

Instance Method Details

#create_bot(name) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/jambots/controllers/new_controller.rb', line 10

def create_bot(name)
  path = Jambots::Bot.find_path(@options[:path])
  model = @options[:model] || Jambots::Bot::DEFAULT_MODEL
  prompt = @options[:prompt]

  Jambots::Bot.create(name, path: path, model: model, prompt: prompt)
  puts "Bot '#{name}' created in '#{path}/#{name}'"
end