This bot retweets the latest tweet using the "João Pessoa" word. He tries to retweet every five minutes
Note: you must be comfortable using your computer's command line interface to use this bot. If you've never used it, there are tutorials for Mac OSX and Windows.
If you don't already have have them, please install Node.js. This will install two programs: node
, which runs JavaScript from the command line, and npm
, which helps you install software that Node.js can run.
Make an empty project directory somewhere convenient for you, download this file, and unzip the contents to your project directory. Go to your project directory in the command line. There should be four files there: .gitignore
, README.md
, package.json
and .env.exemple
also the folder src
with index.js
and config.js
.
In main directory type:
npm install
This installs some code to the npm_modules
subdirectory, which you don't need to worry about.
At this point you need to register a Twitter account and also get its "app info".
So create a Twitter account for whatever account you want to tweet this stuff. Twitter doesn't allow you to register multiple twitter accounts on the same email address. I recommend you create a brand new email address (perhaps using Gmail) for the Twitter account. Once you register the account to that email address, wait for the confirmation email. Then go here and log in as the Twitter account for your bot:
https://apps.twitter.com/app/new
Once you're there, fill in the required fields: name, description, website. None of it really matters at all to your actual app, it's just for Twitter's information. Do the captcha and submit.
Then go to the Keys and Access Tokens tab, and at the bottom click "create my access token". Nothing might happen immediately. Wait a minute and reload the page. then there should be "access token" and "access token secret", which are both long strings of letters and numbers.
Now use a text editor to open up the "config.js" file. It should look like this: \
module.exports = {
consumer_key: 'key',
consumer_secret: 'key',
access_token: 'key',
access_token_secret: 'key'
}
In between those quotes, instead of 'key'
, paste the appropriate info from the Details page. This is essentially the login information for the app.
Now type the following in the command line in your project directory:
npm start
Hopefully at this point you see a message like "Success! Check your bot, it should have retweeted something." Check the Twitter account for your bot, and it should have retweeted a tweet with the "João Pessoa" word.
you can change a search string using the value of the constant 'q' file n index.js
. See the documentation
MIT License | View License |
Donate a star, like, follow and contribute in any way. Be sure to use it NOW. If you use this Twitter Bot, kindly hit me up! JUST simply Tweet Me.