Class: Chatterbot::Skeleton

Inherits:
Object
  • Object
show all
Defined in:
lib/chatterbot/skeleton.rb

Overview

bot template generator

Class Method Summary collapse

Class Method Details

.generate(bot) ⇒ Object

generate a template file for the specified bot

Parameters:

  • bot (Bot)

    object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/chatterbot/skeleton.rb', line 12

def generate(bot)
  path = File.join(Chatterbot.libdir, "..", "templates", "skeleton.txt")
  src = File.read(path)

  opts = bot.config.to_h.merge({
    :name => bot.botname,
    :timestamp => Time.now
  })

  src % opts
end