Skip to content

DiscoverQuotesDaily Bot is a Python-based bot that generates and posts inspirational quotes daily on Twitter. It can fetch quotes from various categories and generate visually appealing images featuring these quotes, with scheduled posting and on-request generation.

License

Notifications You must be signed in to change notification settings

xdityagr/Project-DiscoverQuotesDaily

Repository files navigation

Alt text

DiscoverQuotesDaily Bot

DiscoverQuotesDaily Bot is a Python-based bot that generates and posts inspirational quotes daily on Twitter. It can fetch quotes from various categories and generate visually appealing images featuring these quotes. The bot schedules daily posts and interacts with the Twitter API to share the generated images.

Features

  • Daily Inspirational Quotes: Automatically posts a new quote each day.
  • Customizable Quotes: Fetches quotes based on various tags from the Quotable API.
  • Image Generation: Creates images with quotes using the Pillow library.
  • Twitter Integration: Posts images and quotes on Twitter using Tweepy.

Installation

Prerequisites

  • Python 3.6 or higher
  • pip (Python package installer)

Steps

  1. Clone the Repository

    git clone https://github.com/yourusername/DiscoverQuoteBot.git
    cd DiscoverQuoteBot
  2. Install Dependencies

    Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`

    Install the required packages:

    pip install -r requirements.txt
  3. Configuration

    • Quotes API: No additional configuration required.

    • Twitter API: Create a twitterCredentials.json file in the root directory with the following structure:

      {
        "access_token" : "YOUR_ACCESS_TOKEN",
        "access_token_secret" : "YOUR_ACCESS_TOKEN_SECRET",
        "bearer_token": "YOUR_BEARER_TOKEN_SECRET",
        "api_key":"YOUR_API_KEY",
        "api_key_secret":"YOUR_API_KEY_SECRET",
        "client_id":"YOUR_CLIENT_ID",
        "client_secret":"YOUR_CLIENT_SECRET"
      }
  4. Run the Bot

    Start the bot using:

    python DiscoverQuoteBot.py

Code Overview

  • DiscoverQuoteBot.py: Main script that runs the bot, schedules daily posts, and handles image generation and Twitter posting.
  • bot_utils.py: Contains utility classes for interacting with the Quotable API, generating quote images, and posting to Twitter.

DiscoverQuoteBot.py

The main function daily_post_loop fetches a quote, generates an image with the quote, saves it, and posts it to Twitter. The bot is scheduled to run this function daily.

bot_utils.py

  • Quote: Retrieves a random quote from the Quotable API and handles tag selection.
  • QuoteImageGenerator: Generates images with quotes using the Pillow library, adjusting text wrapping and font size dynamically.
  • TwitterConnHandler: Manages Twitter API connections and handles posting of tweets with images.

Usage

  • The bot runs continuously and posts a new quote daily.
  • Modify tags.json to change the categories of quotes.
  • Adjust image generation settings by editing the QuoteImageGenerator class.

Contributing

If you want to contribute to DiscoverQuoteBot, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your changes.
  3. Commit your changes and push them to your fork.
  4. Open a pull request with a clear description of your changes.

License

This project is licensed under the GPL License. See the LICENSE file for details.

Contact

For questions or feedback, please contact:

Enjoy using DiscoverQuotesDaily! Made with <3 In India!

About

DiscoverQuotesDaily Bot is a Python-based bot that generates and posts inspirational quotes daily on Twitter. It can fetch quotes from various categories and generate visually appealing images featuring these quotes, with scheduled posting and on-request generation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages