Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 36 lines (31 sloc) 1.195 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
# If using the gem, replace with:
#
# require 'rubygems'
# require 'james'
require File.expand_path '../../lib/james', __FILE__

# Time dialog by Florian Hanke.
#
# This is a very simple James example.
#
# It has only one state, :joke, and a single
# entry/hook phrase, "Tell me a joke"
#
# Improve the jokes ;)
#
James.dialog do

  hear 'Tell me a joke' => :joke

  state :joke do
    jokes = [
      'What do you say to a cow that crosses in front of your car? ... ... Mooove over.',
      'What\'s green, has 6 legs, and if it falls out of a tree and lands on you, it could hurt? ... ... A pool table.',
      'What is the one thing everybody in the world is doing at the same time? ... ... Growing older.',
      'How many hamburgers can you eat on an empty stomach? ... ... Only one or part of one, because after that, your stomach is no longer empty.',
      'What\'s the difference between a jeweler and a jailor? ... ... One sells watches, and the other watches cells.',
      'What did the elephant say to the naked man? ... ... How do you breathe through that thing?'
    ]
    hear 'Another one'
    into do
      "#{jokes[rand(jokes.size)]} ... ... ... Ha ha ha."
    end
  end

end
Something went wrong with that request. Please try again.