Welcome to the Motivational Quote Bot! This simple yet powerful bot generates daily motivational quotes using OpenAI's GPT-3 and posts them to Twitter. It's the perfect way to keep your Twitter feed filled with positive vibes and hustle energy. Let's get inspired, one tweet at a time! πͺ
π€ Built with π» and β by a BBIT student passionate about tech & motivation.
π¬ Contact: @johnboscomueti | Email: muetijohnbosco35@gmail.com
The bot's goal is to:
- Generate unique, tweet-length motivational quotes.
- Use OpenAIβs powerful GPT-3 model for crafting custom content.
- Post these quotes automatically to your Twitter account.
- Inspire and energize Gen Z & Millennials, especially from the urban hustle in Kenya. π
- AI-powered Motivational Quotes: Generated by OpenAIβs GPT-3 model, the quotes are tailored for urban African millennials.
- Twitter Integration: The bot posts directly to your Twitter account via Tweepy.
- Customizable: You can tweak the style of quotes or adjust the post frequency.
- Python: The language used to build the bot.
- OpenAI API: The brain behind the motivational quotes.
- Tweepy: Python library used to tweet the quotes.
- GitHub Actions: To automate the daily tweeting.
Follow the steps below to set up the bot on your local machine or cloud server:
###bash pip install openai tweepy
2οΈβ£ Set Up API Keys You will need credentials for both OpenAI and Twitter:
OpenAI: Get your API key
Twitter: Create a Twitter Developer App
Then, set the following environment variables: export OPENAI_API_KEY="your_openai_api_key" export TWITTER_CONSUMER_KEY="your_twitter_consumer_key" export TWITTER_CONSUMER_SECRET="your_twitter_consumer_secret" export TWITTER_ACCESS_TOKEN="your_twitter_access_token" export TWITTER_ACCESS_TOKEN_SECRET="your_twitter_access_token_secret"
3οΈβ£ Run the Bot To post a single quote:
bash python post_quote.py This will generate a motivational quote and tweet it instantly. β
4οΈβ£ Automate with GitHub Actions Create the following workflow file in your repo:
π .github/workflows/bot.yml name: Post Motivational Quotes
on: schedule: - cron: "0 9 * * *" # Every day at 9:00 AM UTC
jobs: post_quote: runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v2
name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install Dependencies
run: |
pip install openai tweepy
- name: Run Bot
run: |
python post_quote.py
π Now your bot will post a motivational quote every morning at 9:00 AM UTC!
π¦ Code Overview post_quote.py does the following:
Generates a motivational quote from GPT-3 with keywords like glow up, money moves, and Kenyan hustle.
Posts that quote using the Tweepy Twitter API.
Uses environment variables to keep your credentials secure.
π§ Troubleshooting RateLimitError from OpenAI?
Youβve likely hit your free usage cap.
Add billing to your OpenAI account or wait for quota reset.
Implement retry logic to handle temporary errors (e.g. exponential backoff).
π€ Contributing Found a bug? Want to improve quote style? Pull requests and forks are welcome!
π License This project is open-source and available under the MIT License.
π Final Words Enjoy the positive vibes, and letβs keep the Kenyan hustle strong! Start your mornings with π₯ energy and π― mindset. Keep glowing. Keep going.
If you'd like, I can help generate a post_quote.py
, .env.example
, and requirements.txt
to fully complete the repo setup. Let me know!