Sha256: 32a44e293d7af54b38f20dc46c50bfe52a5eb493dfe4e8b381e805d080461c49
Contents?: true
Size: 447 Bytes
Versions: 1
Compression:
Stored size: 447 Bytes
Contents
require 'ibot' bot = IBot.new bot.add_group :greeting bot.add_group :by bot.add_pattern :greeting, /hi/i bot.add_pattern :greeting, /hello/i bot.add_pattern :by, /goodby/i bot.add_response :greeting, 'Hi' bot.add_response :greeting, 'Hello' bot.add_response :by, 'Goodby' bot.add_response :by, 'By' loop do a = gets b = bot.pattern_defined? a next if b.nil? if bot.match?(b, a) puts bot.response b else puts b end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ibot-0.0.0 | example/first.rb |