freeCodeCamp / 100DaysOfCode-twitter-bot

Twitter bot for #100DaysOfCode
https://twitter.com/_100DaysOfCode
BSD 3-Clause "New" or "Revised" License
285 stars 110 forks source link

Use stream #103

Closed spences10 closed 7 years ago

spences10 commented 7 years ago

Added to use the twit stream in place of search which wasn't the most reliable way to find tweets on multiple search criteria, now there's a tweets object which has items from the twitter stream added to it to be popped off at a later time.

The .env file can now have the QUERY_STRING updated to include the required search terms separated with a comma:

QUERY_STRING=100daysofcode,301daysofcode,codenewbie

I've had to separate out config.js keys to cater for the additional env variables that are needed:

TWITTER_USERNAME=AccountNameToUse
TWEET_TIME_OUT_MIN=10
TWEET_TIME_OUT_MAX=1
TWEET_QUEUE_TIME=10

TWEET_QUEUE_TIME is how often you want to check items in the tweets object, TWEET_TIME_OUT_MIN ..._MAX is the time delay added to the tweet object.

The above will run every ten minutes and assign a timeOut value to the tweets object between the two given TWEET_TIME_OUT_MIN ..._MAX values in this case between 1 and 10 minutes.

Closes #86

amandeepmittal commented 7 years ago

Great Work @spences10! The PR is now live.