Code Monkey home page Code Monkey logo

mildmodbot's Introduction

MildModBot

A bot providing an efficient way to execute r/MildlyInteresting's preventive restriction policy.

So, how does this policy work? You can learn everything from the link above, but TL;DR for every time mods remove your post, you get one strike. Three strikes, and you're banned*

* The bot does not ban the user, but sends you a modmail every time a user reaches three strikes.

Setup

To set up the bot, you'll need a client ID and a client secret. Get those by making a script-type app at https://reddit.com/prefs/apps

Using Docker

This is the recommended route, as it's much more straightforward and requires less technical skills.

For this path, you will need to install Docker.

  1. Use docker pull xeoth/mildmodbot to pull the image.
  2. Create an env.txt file and put the following content inside:
MMB_USERNAME=your_bot_username
MMB_PASSWORD=your_bot_password
MMB_CLIENT_ID=your_bot_client_id
MMB_CLIENT_SECRET=your_bot_client_secret
MMB_SUBREDDIT=mildlyinteresting
  1. Run the image with docker run --env-file ./env.txt --restart unless-stopped --detach xeoth/mildmodbot (of course replacing ./env.txt with the actual path to that file).

You should see an ID printed out. To see whether it works, use docker ps and check if "Up X seconds" is the status of xeoth/mildmodbot. If so, it should be up and running. Check your sub's modlog to see whether it's assigning flairs.

You can view the logs using docker logs [container ID here] or with the desktop app.

Manually

Windows

  1. Right-click on Start and click "Windows Powershell"
  2. Declare a few environmental variables using these commands:
$env:MMB_CLIENT_ID="your client ID"
$env:MMB_CLIENT_SECRET="your client secret"
$env:MMB_USERNAME="your bot's username"
$env:MMB_PASSWORD="your bot's password"
$env:MMB_SUBREDDIT="your subreddit"
  1. Clone the repo via git clone https://github.com/Xeoth/MildModBot.git (you may need to install git first; if you don't want to install it, download the code as ZIP and unpack it).
  2. cd into the newly created MildModBot folder
  3. Use py -m venv venv to create a virtual environment, and activate it via .\venv\Scripts\activate.ps1 (you may need to install Python first)
  4. Use pip3 install -r requirements.txt to install bot's dependencies
  5. Finally, use py src\index.py to run the bot.

If you did everything right, you will get a message saying "INFO: The bot is running."

Linux

  1. Launch a terminal. Or, if your entire system is just a terminal, don't do anything.
  2. Declare a few environmental variables using this command:
export MMB_CLIENT_ID="your client ID" \
       MMB_CLIENT_SECRET="your client secret" \
       MMB_USERNAME="your bot's username" \
       MMB_PASSWORD="your bot's password" \
       MMB_SUBREDDIT="your subreddit"
  1. Clone the repo via git clone https://github.com/Xeoth/MildModBot.git (you may need to install git first; if you don't want to install it, download the code as ZIP and unpack it).
  2. cd into the newly created MildModBot folder
  3. Use python3 -m venv venv to create a virtual environment, and activate it via ./venv/bin/activate. (you may need to install Python first)
  4. Use pip3 install -r requirements.txt to install bot's dependencies
  5. Finally, use python3 src/index.py to run the bot.

If you did everything right, you will get a message saying "INFO: The bot is running."

mildmodbot's People

Contributors

xeoth avatar

Stargazers

Kasper Wikstrom avatar Dan Burkhardt avatar Ammar avatar Nate avatar Micah Corning-Myers avatar

Watchers

Kostas Georgiou avatar  avatar

mildmodbot's Issues

Change to another caching provider

There's no actual need for a persistent data store, so using SQLite might not be an appropriate option here. Consider Redis, Memcached or in-memory SQLite.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.