Skip to content

A reddit bot, written in rust, replying to comments, containing factorials, on r/mathmemes with the solution

License

Notifications You must be signed in to change notification settings

tolik518/factorion-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Factorion-Logo which looks like a robot from futurama

Factorion-bot

A reddit bot replying to comments, containing factorials, with the solution. This little fella is currently running on r/mathmemes and on r/ProgrammerHumor.

Table of Contents

Getting Started

Follow these steps to set up and run the Factorion bot on your local machine and account.

Prerequisites

  • Rust (latest stable version) - Install Rust
  • Reddit Account - To run the bot, you'll need a Reddit account. Reddit

Reddit API Credentials

You can go to Reddit API Documentation to checkout all the different endpoints you can access.
  1. We need Application ID and Secret Key so that Reddit can know about our app. preferences/apps
  2. Click the are you a Developer? button to start setting up the bot.
Screenshot
  1. Fill in the required details:
    • Name: Choose a name for your bot.
    • App type: Select Script.
    • Redirect URI: Use http://localhost:8080 (or any URI; it’s not used for script bots).
Screenshot
  1. After creating the app, you'll receive:
    • client_id (listed under the app name)
    • client_secret
    • A username and password (for the Reddit account that created the app)

Installation

Fork/Clone the repository and navigate to the project directory:

git clone https://github.com/yourusername/factorion-bot.git
cd factorion-bot

Configuration

Create a .env file in the project root with the following variables:

CLIENT_ID=<your_client_id>
CLIENT_SECRET=<your_client_secret>

USERNAME=<reddit_app_username>
PASSWORD=<reddit_app_password>

SLEEP_BETWEEN_REQUESTS=<sleep_time>
SUBREDDITS=<subreddits>

Replace <your_client_id>, <your_client_secret>, <reddit_app_username>, and <reddit_app_password> with the values you received from the Reddit App creation.

Run the following command to install dependencies:

Refer to Cargo.toml
cargo build

Usage

Run the bot with:

cargo run

How does it work in Reddit?

  1. Create a new user for the bot so it can be mentioned by /u/<botname>

  2. Create a new subreddit /r/<botname> as a test play ground.

Running on a server

The recommended way would be running the bot using docker.

git clone https://github.com/tolik518/factorion-bot
docker build -t factorion-bot .
# either create a network called `service-network` or remove the network if not needed
docker run --rm -d --name factorion-bot --volume $(pwd):/usr/factorion factorion-bot:latest ./run.sh

Contributing

Feel free to submit issues or pull requests if you would like to contribute to this project.

About

A reddit bot, written in rust, replying to comments, containing factorials, on r/mathmemes with the solution

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages