Sha256: 8e9f0a38a8f003ac6535934696ba8fdae68299711e747ae1c0a955e711e3054f

Contents?: true

Size: 952 Bytes

Versions: 17

Compression:

Stored size: 952 Bytes

Contents

#!/usr/bin/env ruby

#
# simple example of how to run a bot in a loop. if you want to do
# that, you need to call update_config to update the database at the
# end of each iteration -- this will keep you from processing the same
# tweets multiple times
#


#
# require the dsl lib to include all the methods you see below.
#
require 'rubygems'
require 'chatterbot/dsl'

puts "Loading echoes_bot.rb"

##
## If I wanted to exclude some terms from triggering this bot, I would list them here.
## For now, we'll block URLs to keep this from being a source of spam
##
exclude "http://"

blacklist "mean_user, private_user"

loop do

  puts "run search #{since_id}"
  search "twitter" do |tweet|
    # here you could do something with a tweet
  end
  
  puts "checking for replies to me"
  replies do |tweet|
    src = "#USER# it is very nice of you to say that!"  
    reply src, tweet
  end

  # explicitly update our config
  update_config

  sleep 1
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
chatterbot-1.0.2 examples/loop_bot.rb
chatterbot-1.0.1 examples/loop_bot.rb
chatterbot-1.0.0 examples/loop_bot.rb
chatterbot-0.9.3 examples/loop_bot.rb
chatterbot-0.9.2 examples/loop_bot.rb
chatterbot-0.9.1 examples/loop_bot.rb
chatterbot-0.9.0 examples/loop_bot.rb
chatterbot-0.7.1 examples/loop_bot.rb
chatterbot-0.7.0 examples/loop_bot.rb
chatterbot-0.6.6 examples/loop_bot.rb
chatterbot-0.6.5 examples/loop_bot.rb
chatterbot-0.6.3 examples/loop_bot.rb
chatterbot-0.6.2 examples/loop_bot.rb
chatterbot-0.6.1 examples/loop_bot.rb
chatterbot-0.5.1 examples/loop_bot.rb
chatterbot-0.5.0 examples/loop_bot.rb
chatterbot-0.4.0 examples/loop_bot.rb