Sha256: a5a93689d63320ffc8b80a598d8fd32f146df19435b8fc3f107c42b3efdeaa9f
Contents?: true
Size: 950 Bytes
Versions: 2
Compression:
Stored size: 950 Bytes
Contents
require_relative 'src/<%= bot_name %>.rb' require "twitter" require "tweetstream" Twitter.configure do |config| config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] config.oauth_token = ENV['TWITTER_OAUTH_TOKEN'] config.oauth_token_secret = ENV['TWITTER_OAUTH_SECRET'] end TweetStream.configure do |config| config.consumer_key = ENV['TWITTER_CONSUMER_KEY'] config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET'] config.oauth_token = ENV['TWITTER_OAUTH_TOKEN'] config.oauth_token_secret = ENV['TWITTER_OAUTH_SECRET'] config.auth_method = :oauth end loop do begin puts "starting search" TweetStream::Client.new.sample(language: 'en') do |tweet| if <%= class_name %>.matches? tweet.text puts "got one!" Twitter.retweet tweet.id end end rescue puts 'FAILURE' ensure sleep 300 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twitter_bot_generator-0.2.1 | lib/twitter_bot_generator/templates/streaming-bot.rb.erb |
twitter_bot_generator-0.2.0 | lib/twitter_bot_generator/templates/streaming-bot.rb.erb |