Skip to content

A Twitter-Bot that uses the Twitter API to occasionally send Motivational quotes. You can use this Bot to stay Motivated during high-stress levels and low motivation levels.

License

Notifications You must be signed in to change notification settings

ArreyTabe/Ruby-Capstone--Twitter-Motivational_Bot

Repository files navigation

Motivational Twitter-Bot

microverse

A twitter Bot that uses the twitter API to occasionally send Motivational quotes. You can use this to stay Motivated during high stress levels and low motivation levels. It can be initialized on the command line(windows) / terminal(mac & linux) where it tweets motivational messages(quotes).

Built With

  • Ruby 2.7.0

  • VS Code

  • Twitter Bot API

  • Nokogiri gem

  • Twitter-gem

  • Open URI

How to Install

afftech uses the dotenv gem in order to access Environment Variables for the required API key and Twitter access tokens.

Follow the next steps to configure all that's needed:

  • Install Ruby in your system. To install Ruby, you can read the Documentation If you have installed Git in your system, you can clone it using git clone command.

  • Clone the project by running https://github.com/ArreyTabe/Ruby-Capstone--Twitter-Motivational_Bot.git on Terminal/CMD or download and extract it from the repository. OR Download it as a Zip File.

  • Open Terminal/CMD and cd into the the folder you downloaded or cloned.

  • Execute touch .env from the projects root directory

  • make sure you have a twitter devolper account, go to your dashboard and while still logged into your twitter account,the first thing you want to do is create a new app. For convenience, use the same name as your account.

  • Adjust the permissions to Read and write

  • Next, go to the API Keys page and click “Generate my Access Token,” and then copy:

  • Consumer Key

  • Consumer Secret

  • Access Token

  • Access Token Secret

  • On your .env file add your token like this:

  • 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"

  • Run bundle install from the project's root directory to install dependencies.

  • Run `bundle exec bin/main.rb'

  • Navigate to your twitter account

How to Test the Methods In the Classes

Install Rspec gem in your system. To do this:

Open Command Prompt or Terminal and run:

gem install Rspec

Navigate into the spec folder and run the following at the console:

testing_tweetbot_spec.rb

Deployment to Heroku

In order to deploy the bot to Heroku you need a free Heroku account and follow the next steps:

  • Go to your Heroku Dashboard and click on the New button located on the top-right corner.

  • Click on Create new app and then give it a name.

  • Select a Deployment Method. GitHub is the easiest one since you only need to provide your credentials. To deploy from GitHub you need to have a copy of the source code hosted there, so do that before selecting GitHub as deployment method.

Remember NOT to commit API credentials to public places. The .gitignore file should handle that already but make sure you're not doing it.

  • Set your API Credentials in Heroku as Environment Variables by clicking on the Settings tab and then adding them to the Config Vars section.
  • Go to the Resources tab on Heroku and click on the pencil icon to edit the Heroku Dyno.
  • Turn it on and click on Confirm. Once you do that everything should be ready.

Twitter bot screenshot

Contributing

Contributions, issues, and feature requests are welcome! Start by:

  • Forking the project
  • Cloning the project to your local machine
  • cd into the project directory
  • Run git checkout -b your-branch-name
  • Make your contributions
  • Push your branch up to your forked repository
  • Open a Pull Request with a detailed description of the development branch of the original project for a review
  • here is the issue link you can follow as well

Author

👤 Arrey Tabe

Acknowledgments

Show your support

Give a ⭐️ if you like this project!

📝 License

This project is MIT licensed.

About

A Twitter-Bot that uses the Twitter API to occasionally send Motivational quotes. You can use this Bot to stay Motivated during high-stress levels and low motivation levels.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages