Skip to content

almeidx/discord-ban-sync

Repository files navigation

Discord Ban Sync

A Discord bot that automatically synchronizes bans between multiple Discord servers, ensuring consistent moderation across your server network.

Table of Contents

Features

  • ⚡ Real-time ban updates across your Discord servers
  • 🔒 Secure and reliable ban management
  • 🛠️ Easy setup and configuration

Prerequisites

Before you begin, ensure you have the following installed:

  • Git
  • Node.js (v24.1.0 or higher)
  • pnpm (v10.11.0 or higher)
  • Docker (optional, for containerized deployment)
  • PM2 (optional, for process management)

Installation

Cloning Repository

This assumes you already have Corepack enabled on your system. If you don't, you can enable it using corepack enable, as it comes preinstalled with Node.js.

git clone [email protected]:almeidx/discord-ban-sync.git
cd discord-ban-sync

Environment Setup

  1. Copy the example environment file:
cp .env.example .env
  1. Configure your environment variables in the .env file

Configuration

Variable Description Example Required
DISCORD_TOKEN Your Discord bot token your-bot-token-here Yes
GUILD_IDS Comma/Newline-separated list of server IDs 123456789012345678,123456789012345678 Yes
DELETE_MESSAGE_SECONDS Amount of seconds of messages to delete from users when banning (0-604800) 604800 (7 days) No

Usage

Running with Docker

The easiest way to run the bot is using Docker. You have two options:

Option 1: Using Docker Compose

  1. Copy the example environment file:
cp .env.example .env
  1. Configure your environment variables in the .env file

  2. Start the bot:

docker compose up -d
  1. View logs:
docker compose logs -f
  1. Stop the bot:
docker compose down

Option 2: Using Docker directly

  1. Pull the latest image:
docker pull ghcr.io/almeidx/discord-ban-sync:latest
  1. Run the container with environment variables:
docker run -d \
  --name discord-ban-sync \
  -e DISCORD_TOKEN=your-bot-token-here \
  -e GUILD_IDS=123456789012345678,987654321098765432 \
  -e DELETE_MESSAGE_SECONDS=604800 \ # Optional
  ghcr.io/almeidx/discord-ban-sync:latest
  1. View logs:
docker logs -f discord-ban-sync
  1. Stop the container:
docker stop discord-ban-sync
docker rm discord-ban-sync

Running locally

First off, setup the environment:

If you don't have Corepack enabled, you can do it using corepack enable, as it comes preinstall with Node.js.

corepack install
pnpm install --frozen-lockfile

Directly

node --run start

PM2

pm2 start ecosystem.config.cjs

To verify the bot is working, use the /ping slash command in your Discord server.

Updating

To update the bot to the latest version:

git pull --rebase
pnpm install --frozen-lockfile

Then restart the bot using your preferred method (local, Docker, or PM2).

Author

discord-ban-sync © almeidx, released under the Apache 2.0 license.

GitHub @almeidx

About

Sync bans across multiple Discord servers

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •