Skip to content

๐Ÿธ Reddit-Ribbit-Ribbit: A friendly AI Reddit agent that hops into discussions! Powered by Google Gemini ๐Ÿš€, it crafts engaging, Gen Alpha-style comments with emojis โœจ. Features include subreddit monitoring, keyword filtering, image/URL analysis, and a fully customizable "bot brain".

Notifications You must be signed in to change notification settings

VinsmokeSomya/Reddit-Ribbit-Ribbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿšฉ๐Ÿงก๐Ÿ•‰๏ธ || เคœเคฏ เคถเฅเคฐเฅ€ เคฐเคพเคฎ || ๐Ÿ•‰๏ธ๐Ÿงก๐Ÿšฉ

๐Ÿธ Reddit-Ribbit-Ribbit ๐Ÿค–

GitHub repo

Welcome to Reddit-Ribbit-Ribbit! This project is an AI-powered Reddit agent designed to hop into discussions, share some insights (and maybe a frog pun or two! ๐Ÿธ), and engage with communities using a fun, friendly, and modern voice, including Gen Alpha slang and emojis! โœจ

It uses the power of Google's Gemini API for its intelligent comment generation and image understanding capabilities.


๐Ÿš€ About The Project

Reddit-Ribbit-Ribbit is a Python-based bot that:

  • ๐Ÿ‘€ Monitors specified subreddits for new posts.
  • ๐Ÿ”‘ Filters posts based on keywords in their titles.
  • ๐Ÿง  Analyzes post content, including text, linked URLs, and images.
  • ๐Ÿค– Uses the Google Gemini API (specifically a model like gemini-1.5-pro-latest or your configured gemini-2.5-pro-exp-03-25) to generate contextually relevant and engaging comments.
  • ๐Ÿ—ฃ๏ธ Speaks in a customizable persona, incorporating Gen Alpha slang and emojis for a modern, quirky vibe.
  • ๐Ÿ“ Posts these comments to Reddit, adding a unique voice to discussions.
  • โฐ Manages a cooldown period to avoid spamming.
  • ๐Ÿ’พ Remembers posts it has replied to.

Built With:

  • ๐Ÿ Python
  • ๐Ÿค– Google Gemini API
  • praw (Python Reddit API Wrapper)
  • ๐Ÿ“ Dotenv, Requests, BeautifulSoup4, Pillow

๐Ÿ“Š Workflow: How Reddit-Ribbit-Ribbit Hops In!

graph TD
    A[Start Ribbit Agent ๐Ÿธ] --> B{Scan Subreddits for New Posts};
    B -- Post Found --> C{Match Keywords in Title?};
    C -- Yes --> D{Time Since Last Comment OK? โฑ๏ธ};
    C -- No --> B;
    D -- No --> B;
    D -- Yes --> E[Process Post Content: Text, URLs, Images ๐Ÿ–ผ๏ธ];
    E --> F[Fetch Persona & Brain Files ๐Ÿง ];
    F --> G[Generate Comment with Gemini AI โœจ];
    G --> H[Post Comment to Reddit โœ…];
    H --> I[Log Replied Post & Update Timestamp ๐Ÿ’พ];
    I --> B;
Loading

Simplified Workflow:

  1. Launch: Start the ribbit_agent.py script.
  2. Scan & Filter: The bot checks your chosen subreddits for new posts that match your keywords.
  3. Cooldown Check: Ensures it waits a random interval (1-2 hours by default) before commenting again.
  4. Understand: If a post is a match and the cooldown is over, the bot reads the post's text. If there are links, it tries to scrape their content. If it's an image post, it downloads and uses Gemini to describe the image.
  5. Think (with Gemini!): It combines the post's info with its "brain" files (persona_and_instructions.txt, good_comment_examples.txt, etc.) to create a prompt for the Gemini API.
  6. Craft Reply: Gemini generates a comment based on all this context, aiming for a helpful, engaging, and on-brand (lowercase, slang, emojis!) response.
  7. Post & Remember: The bot posts the comment to Reddit and saves the post ID so it doesn't reply again.
  8. Repeat: The cycle continues!

๐Ÿ“ Project File Structure

Reddit-Ribbit-Ribbit/
โ”œโ”€โ”€ .env                                # Stores your API keys and credentials (KEEP THIS SECRET!)
โ”œโ”€โ”€ README.md                           # You are here! ๐ŸŒŸ
โ”œโ”€โ”€ requirements.txt                    # Lists Python dependencies for the project
โ”œโ”€โ”€ ribbit_agent.py                     # The main Python script that runs the bot ๐Ÿค–
โ”œโ”€โ”€ bot_brain_files/                    # Folder containing the bot's personality and knowledge
โ”‚   โ”œโ”€โ”€ persona_and_instructions.txt    # Defines the bot's core persona and general instructions
โ”‚   โ”œโ”€โ”€ good_comment_examples.txt       # Examples of good comments for the bot to learn from
โ”‚   โ”œโ”€โ”€ knowledge_snippets.txt          # Specific facts or info for the bot
โ”‚   โ”œโ”€โ”€ output_rules.txt                # Strict rules for the bot's output (e.g., lowercase, emojis)
โ”‚   โ”œโ”€โ”€ avoid_these_comments.txt        # Examples of comments the bot should NOT make
โ”‚   โ””โ”€โ”€ replied_posts.txt               # Keeps track of posts already replied to (created by script)
โ””โ”€โ”€ img/                                # Directory for temporarily storing downloaded images (created by script)

๐Ÿ› ๏ธ Getting Started / Setup

Follow these steps to get Reddit-Ribbit-Ribbit hopping on your machine!

Prerequisites

  • Python 3.7+ installed.
  • A Reddit account for your bot.
  • A Google Cloud Project with the Gemini API enabled (to get your Google API Key).

Setup Instructions

  1. Clone the Repository:

    git clone https://github.com/VinsmokeSomya/Reddit-Ribbit-Ribbit.git
    cd Reddit-Ribbit-Ribbit
  2. Install Dependencies: It's recommended to use a virtual environment:

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

    Then install the required packages:

    pip install -r requirements.txt

    (Make sure requirements.txt includes google-generativeai and other necessary packages like praw, python-dotenv, requests, beautifulsoup4, Pillow)

  3. Reddit App Setup:

    • Go to https://www.reddit.com/prefs/apps.
    • Scroll down and click "are you a developer? create an app...".
    • Fill in the details:
      • name: RedditRibbitRibbit (or anything you like)
      • type: select script
      • description: (optional)
      • about url: (optional)
      • redirect uri: http://localhost:8080 (important for script apps)
    • Click "create app".
    • You will get a CLIENT ID (under your app name) and a CLIENT SECRET.
  4. Google Gemini API Key:

  5. Environment Variables (.env file):

    • Create a file named .env in the root directory of the project.
    • Add your credentials like this (replace xxx and your_..._here with your actual values):
      REDDIT_CLIENT_ID="YOUR_REDDIT_CLIENT_ID"
      REDDIT_CLIENT_SECRET="YOUR_REDDIT_CLIENT_SECRET"
      REDDIT_USER_AGENT="RedditRibbitRibbit v1.0 by YourUsername" # Make this unique and descriptive
      REDDIT_USERNAME="YOUR_BOTS_REDDIT_USERNAME"
      REDDIT_PASSWORD="YOUR_BOTS_REDDIT_PASSWORD"
      GOOGLE_API_KEY="YOUR_GOOGLE_GEMINI_API_KEY"
  6. Configure the Bot's Brain ๐Ÿง :

    • Navigate to the bot_brain_files/ directory.
    • Edit the following files to customize Reddit-Ribbit-Ribbit's personality and knowledge:
      • persona_and_instructions.txt: Define how your bot should act, its primary goals, and overall tone. Get creative with its froggy, Gen Alpha persona!
      • good_comment_examples.txt: Provide high-quality examples of comments (with slang and emojis!) you want the bot to emulate.
      • knowledge_snippets.txt: Add any specific facts, frog trivia, or information you want the bot to know.
      • output_rules.txt: Define strict rules for its comments (e.g., sentence length, emoji usage).
      • avoid_these_comments.txt: Give examples of what the bot shouldn't say.
  7. Configure Subreddits & Keywords:

    • Open ribbit_agent.py.
    • Modify these lines with your target subreddits and keywords:
      subreddits = ["yoursubreddit1", "anothersub", "askreddit"]
      keywords = ["yourkeyword", "another keyword", "help me find"]

๐ŸŸข Running the Bot

Once everything is configured:

  1. Make sure your virtual environment is activated (if you used one).
  2. Run the script from the project's root directory:
    python ribbit_agent.py
  3. Watch the console for output! The bot will print the subreddits it's searching and any comments it posts.

๐ŸŽจ Customization

  • Persona & Voice: The core of customization lies in the .txt files within the bot_brain_files/ directory. Experiment with different instructions, examples, and rules to shape Reddit-Ribbit-Ribbit's unique character.
  • Targeting: Change the subreddits and keywords lists in ribbit_agent.py to target different communities and topics.
  • Comment Frequency: Adjust the random.randint(3600, 7200) values in ribbit_agent.py to change the cooldown period between comments (values are in seconds).
  • Gemini Model: You can change the Gemini model used (e.g., gemini-1.5-pro-latest, gemini-1.5-flash-latest, or other specific versions) in ribbit_agent.py where comment_generation_model and image_description_model are initialized.

๐Ÿ™Œ Acknowledgements

  • This project was inspired by and evolved from concepts demonstrated in various AI agent tutorials.
  • Special thanks to the creators of PRAW and the Google Gemini API for their excellent tools.
  • Original YouTube Tutorial (if applicable, you mentioned one earlier): [Link to Tutorial if you have one]

Happy Ribbiting! ๐Ÿธ๐Ÿ’ฌ

About

๐Ÿธ Reddit-Ribbit-Ribbit: A friendly AI Reddit agent that hops into discussions! Powered by Google Gemini ๐Ÿš€, it crafts engaging, Gen Alpha-style comments with emojis โœจ. Features include subreddit monitoring, keyword filtering, image/URL analysis, and a fully customizable "bot brain".

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages