Skip to content

parthakk07/X-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

X Bot - Mood-based Tweet Generator

An AI-powered Twitter/X bot that generates engaging tweets based on your mood or topic, finds relevant images from Unsplash, and posts them to your X account.

Features

  • AI Tweet Generation - Uses Google Gemini to create engaging, human-like tweets
  • Smart Image Matching - Analyzes tweets to find relevant images via Unsplash API
  • Media Upload - Automatically downloads and attaches images to tweets
  • Interactive CLI - Preview tweets before posting

Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Configure environment variables in .env:

    # X API credentials (from developer.twitter.com)
    X_API_KEY=your_x_api_key
    X_API_SECRET=your_x_api_secret
    X_ACCESS_TOKEN=your_access_token
    X_ACCESS_TOKEN_SECRET=your_access_token_secret
    
    # Google Gemini API key (from aistudio.google.com)
    GEMINI_API_KEY=your_gemini_api_key
    
    # Unsplash API key (from unsplash.com/developers)
    UNSPLASH_ACCESS_KEY=your_unsplash_access_key
    
  3. Run the bot:

    python main.py

Usage

  1. Enter your mood or topic when prompted
  2. Review the AI-generated tweet
  3. Confirm or cancel the image attachment
  4. Approve posting to X

File Structure

File Description
main.py Main CLI entry point, handles tweet posting via Tweepy
gemini.py Gemini API integration for tweet generation and image query analysis
image.py Unsplash API integration for fetching relevant images
requirements.txt Python dependencies

Requirements

  • Python 3.8+
  • X Developer Account (for API keys)
  • Google AI Studio Account (for Gemini API)
  • Unsplash Developer Account (for image API)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages