-
-
Save muffinista/1387606 to your computer and use it in GitHub Desktop.
bot reply test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LOAD_PATH.unshift File.dirname(__FILE__) + "/lib" | |
require 'chatterbot/dsl' | |
require 'pokerthing' | |
exclude "http://" # block spam tweet | |
blacklist "jerkface, assbutt" # block jerks or self | |
#debug_mode true | |
puts "Bot listening." | |
loop do | |
trap('TERM') { puts 'Exiting...'; $exit = true } | |
trap('INT') { puts 'Exiting...'; $exit = true } | |
break if $exit | |
replies do |tweet| | |
puts "got tweet from @#{tweet[:user][:screen_name]}!" | |
puts " it says: #{tweet[:text]}" | |
# debug | |
File.open('tweet.dat', 'w+') do |f| | |
Marshal.dump(tweet, f) | |
#exit | |
end | |
tweet_text = tweet[:text].to_s | |
tweet_array = tweet_text.gsub(/@echoes_bot/,'').lstrip.squeeze.split(' ') | |
if tweet_array[0] == 'test' | |
hand_text = "#USER# my great message" | |
reply hand_text, tweet | |
else | |
puts "spam" | |
end | |
end | |
sleep 2 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment