Skip to content
Ashon Gonzales edited this page Dec 1, 2024 · 2 revisions

Welcome to the Reddit Bot CLI Wiki!

Reddit Bot CLI is a command-line tool that helps you automate Reddit interactions by monitoring specific subreddits for keywords and posting comments when those keywords are found. This bot can save time by automating responses to relevant Reddit posts and streamlining your interactions.

Key Features:

  • Monitor multiple subreddits for keywords.
  • Automatically post comments on matching posts.
  • Configure settings through a .ini file.
  • Log bot activities for easy tracking.

Getting Started
If you're new to Reddit Bot CLI, check out the Installation and Configuration sections to set up and start using the bot.

Configuration

Setting Up Your Configuration File:

Before using Reddit Bot CLI, you need to set up a configuration file containing your Reddit API credentials and bot settings.

  1. Run the following command to create the configuration interactively:

    reddit-bot-cli --create-config

    This will prompt you to enter the following details:

    • Reddit Client ID
    • Reddit Client Secret
    • Reddit Username
    • Reddit Password
    • Reddit User Agent
    • Subreddits to monitor (comma-separated)
    • Keywords to search for (comma-separated)
    • Comment text to post when a match is found
  2. Alternatively, manually create a config.ini file like this:

    [reddit]
    client_id = YOUR_CLIENT_ID
    client_secret = YOUR_CLIENT_SECRET
    username = YOUR_USERNAME
    password = YOUR_PASSWORD
    user_agent = YOUR_USER_AGENT
    
    [bot_settings]
    subreddits = subreddit1, subreddit2
    keywords = keyword1, keyword2
    comment_text = This is an automated comment!

How to Get Reddit API Credentials:

To get your Reddit Client ID and Client Secret, follow these steps:

  1. Go to the Reddit Developer Apps page.
  2. Click Create App or Create Another App.
  3. Fill out the form:
    • Choose script.
    • Name your app.
    • Set the redirect URI to http://localhost:8080.
  4. Once created, copy your Client ID, Client Secret, and set a User Agent (e.g., reddit-bot-cli/1.0).

Installation

Installation Instructions:

To install Reddit Bot CLI, follow these steps:

  1. Install via pip:

    Open your terminal and run:

    pip install reddit-bot-cli
  2. Verify the installation by typing the following command to see available options:

    reddit-bot-cli --help

Usage

Running the Bot:

Once you’ve configured your bot, you can run it with the following command:

reddit-bot-cli --config /path/to/config.ini

For example:

reddit-bot-cli --config reddit_bot/config.ini

The bot will monitor the specified subreddits and post a comment when it detects any of the configured keywords.

Command-line Arguments:

  • --config : Specify the path to your configuration file (default: config.ini).
  • --create-config : Create a new configuration file interactively.

Logging and Monitoring


Bot Logging:

All bot activity is logged in the logs/bot.log file. You can check this log to see the posts the bot found, when it posted a comment, and any errors or warnings.

Sample Log Entry:

2024-10-10 14:32:03 INFO Found post in subreddit 'example_subreddit' with matching keyword 'example_keyword'
2024-10-10 14:32:05 INFO Posted comment: 'This is an automated comment matching one of the keywords!'

Development & Contribution

Contributing to Reddit Bot CLI:

We welcome contributions! Whether it’s fixing bugs, adding features, or improving documentation, we’d love to see you contribute to the project.

Getting Started with Development:

  1. Clone the repository:

    git clone https://github.com/vashong/reddit-bot-cli.git
  2. Create a virtual environment and install dependencies:

    cd reddit-bot-cli
    python -m venv venv
    source venv/bin/activate  # On Windows use: venv\Scripts\activate
    pip install -r requirements.txt
  3. Run the bot locally:

    python -m reddit_bot.cli --config reddit_bot/config.ini

Contribution Guidelines:

  • Before submitting a PR, ensure all tests pass.
  • Write detailed commit messages and document any new features.

Roadmap

Here’s what we’re working on and planning to add to the Reddit Bot CLI in the future:

  • Add support for Reddit mentions in comments and direct messages.
  • Implement sentiment analysis to adjust bot responses based on post tone.
  • Integrate with additional social media platforms like Twitter, LinkedIn, Instagram, and Facebook.

Stay tuned for updates!

FAQ

1. Why is my bot not posting comments?

  • Make sure your configuration file is correct and contains valid Reddit API credentials.
  • Check if the keywords you’re monitoring are actually appearing in posts.
  • Ensure the bot has the correct permissions to post comments on Reddit.

2. How do I monitor multiple subreddits?

  • In your config.ini, list the subreddits you want to monitor, separated by commas:
subreddits = subreddit1, subreddit2, subreddit3

3. Can I customize the comment the bot posts?

  • Yes! In your configuration file, set the comment_text to whatever you’d like the bot to post:
comment_text = This is my custom automated comment!

Home

Project Links

Full Docs


Website

Clone this wiki locally