This project is Microverse Ruby Capstone project. I have built a bot that posts a tweet at 12pm every day. I have selected three pages that interest me and my bot will retweet one of the recent 10 posts out of these three pages. It will also check its memory to confirm that it does not retweet the same tweet.
- RUBY
- Ruby Twitter Gem
- RSpec
- Visual Code
To get a local copy up and running follow these simple steps.
- Run
bundle install
to install the required gems on your computer
- Click on the "code" button above on this page and copy the link to the repository
- Open a terminal (CTRL + ALT + T), type
git clone
and paste the link you copied in the previous step, then hit Enter Ex: ‘git clone https://github.com/RailonA/Twitter-bot.git’ - Go to the cloned repository using
cd
command ###Getting Your API Keys
After setting up your Twitter Developer Portal, you will need to make a new App.
On the top-left side select the arrow pointing down
Select the Overview
Select +Add App
After Making an app, you should see Settings
and Keys and Tokens
Select Keys and Tokens
You should now see Consumer Keys, please select Regenerate
for the API key & secret
as well as the Access token & secret
Use these credentials to fill out :
config.consumer_key = "YOUR_CONSUMER_KEY" config.consumer_secret = "YOUR_CONSUMER_SECRET" config.access_token = "YOUR_ACCESS_TOKEN" config.access_token_secret = "YOUR_ACCESS_SECRET"
From the root folder (EX: ../Twitter-bot$
), run ruby bin/bot.rb
You should see something similar to
‘Fascinating stuff done by @SpaceXRT @nettofarah: For some reason, Rails + PostgreSQL + Plain CSS + Heroku still beats every single “modern stack” for web app develop… https://t.co/DQmHieWRfZ’
For the code to push the content to your Twitter page, you must go to the ‘lib/tweet_methods.rb‘ file and uncomment line 44 by highlighting the line and pressing (CTRL + ?) ‘@twitter.update("Fascinating stuff done by @#{@option_data_name[@randome_page]}" + selected_tweet)’ We can now delete line 43 ‘ puts "Fascinating stuff done by @#{@option_data_name[set_randome_page]}" + selected_tweet’
Run the program again by typing run ruby bin/bot.rb
You will now see a new Tweet on your Twitter account.
👤 Railon Acosta
- GitHub: @railonA
- Linkedin: @railonAcosta
- Twitter: @railonAcosta
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if you like this project!
Thanks to both parties involved in the development of this project.