A Simple Twitter Bot built using the npm twit Twitter API Client. The bot periodically finds recent tweets with the keywords 'infinity' or 'avengers' and replies to the tweet with a spoiler for the movie. _
1. Ensure that Node.js and npm have been installed
Visit the official downloads page in case of any issue.
2. Clone the repo
git clone https://github.com/gauravsofat/random-spoiler.git
3. Install Dependencies
cd random-spoiler # Go to the project root directory
npm install
4. Create Your Own Twitter Application
Follow this guide to create your own Twitter Application to obtain your own API Keys, Secrets and Access Tokens.
5. Create Config File
In the project root directory create a file config.js
which contains your
twitter app's access keys and tokens. A typical config.js file should look like
this -
//config.js
module.exports = {
consumer_key: '', // insert consumer key (API Key)
consumer_secret: '', // insert consumer secret (API Secret)
access_token: '', // insert access token
access_token_secret: '' // insert access token secret
}
6. Run An Instance
cd random-spoiler # Go to the project root directory
npm start
Note: An individual call to npm start
will run the bot only once. To ensure
that it keeps running you must schedule this task with a tool like cron.