Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'twitter'
- #### Get your twitter keys & secrets:
- #### https://dev.twitter.com/docs/auth/tokens-devtwittercom
- Twitter.configure do |config|
- config.consumer_key = 'blahblahblah'
- config.consumer_secret = 'blahblahblah'
- config.oauth_token = 'blahblahblah'
- config.oauth_token_secret = 'blahblahblah'
- end
- search_term = URI::encode('@martynkeigher')
- SCHEDULER.every '1m', :first_in => 0 do |job|
- begin
- tweets = Twitter.search("#{search_term}").results
- if tweets
- tweets.map! do |tweet|
- { name: tweet.user.name, body: tweet.text, avatar: tweet.user.profile_image_url_https }
- end
- send_event('twitter_mentions', comments: tweets)
- end
- rescue Twitter::Error
- puts "\e[33mFor the twitter widget to work, you need to put in your twitter API keys in the jobs/twitter.rb file.\e[0m"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement