Skip to content
/ test-area Public

A Discord bot to easily create testing servers, without having to write in that 2FA code to delete it later

License

Notifications You must be signed in to change notification settings

biaw/test-area

Repository files navigation

Docker test Linting Testing discord.js version GitHub Issues GitHub Pull Requests

Test Area

Endlessly tired of making and deleting test servers and having to enter that painful two-factor code? Pssh, that was so 2020...

Test Area is a self-hosted Discord bot that creates temporary servers for you to test your other bots on.

Motivation

This started as a side-gig in April 2021 after I got tired of making a lot of testing servers, then wanting to clean them up, only having to insert that bloody two-factor code.

Nowadays we have security keys, but the pain is still there. Wouldn't it be nice to just ... delete using a simple command? Maybe like this?

So, here we are.

Prerequisites

You only need Docker (and Docker Compose) to self-host this bot.

Installation

Test Area comes in a Docker image: ghcr.io/biaw/test-area, which it makes it really simple to set up using Docker.

  1. You will need at least two bots set up.
    • The first bot will be your main bot. Set it up like this:
      • Installation: Set to both Guild Install and User Install, without an install link.
      • Bot: Make sure it is private. Reset the token and save it.
    • The second one will be your worker bot. Set it up like this:
      • Installation: Set to Guild Install only, without an install link.
      • Bot: Make sure it is private, and that all intents are enabled. Reset the token and save it.
  2. Copy the example.env file to .env in a new folder, and fill in its values. The first bot token goes in CLIENT_TOKEN, and the second bot token goes in WORKER_TOKENS. The OWNER_ID is your Discord user ID. The rest is optional.
  3. Copy the following docker-compose.yml file to the same folder:
services:
  bot:
    image: ghcr.io/biaw/test-area:latest
    restart: always
    env_file: .env
    environment:
      - CLIENT_TOKEN=$CLIENT_TOKEN
      - WORKER_TOKENS=$WORKER_TOKENS
      - DATABASE_URI=mongodb://db
      - OWNER_ID=$OWNER_ID
      - THEME_COLOR=$THEME_COLOR
      - AREA_LIMIT_PER_USER=$AREA_LIMIT_PER_USER
      - DISABLE_FUNNY_WORKER_NAMES=$DISABLE_FUNNY_WORKER_NAMES
    volumes:
      - ./logs:/app/logs
    depends_on:
      - db
  db:
    image: mongo:8
    restart: always
    volumes:
      - ./database:/data/db
  1. Run docker-compose up -d in the folder where you saved the docker-compose.yml file.
  2. Invite the user bot to your server using this link: https://canary.discord.com/oauth2/authorize?client_id=YOUR_BOT_ID. See troubleshooting if you experience any issues when inviting the bot.
  3. You're done! You can now use the bot using the main /testarea command.

Troubleshooting invites

For some reason, user apps can only be installed when there's an install link set up, at least as of writing this. If you're ever getting weird errors when trying to invite the user bot then try to temporarily add the built-in invite to the Installation page. See below.

Make sure you save before trying! You can remove the install link again once it's installed.

FAQ

Why do I need two bots?

A simple answer is that a Discord bot can only create new guilds when it's in less than 10 guilds. This is a limitation set by Discord. We've therefore implemented the simplest workaround possible: a second bot dedicated in creating guilds.

Can I have more than 10 test areas?

Yes, you can. A worker bot can only create 10 guilds total, so if you want more then you will need to add a second worker. If you want more than 20, add a third worker, and so on.

You can do this by supplying multiple worker tokens in the WORKER_TOKENS environment variable, separated by a comma.

Why does my worker bots have new names, like harsh handsaw#7622 or sumptous titanium#4604?

When initializing a new worker, the worker needs a name for logging. So, naturally, as any chaotic evil programmer would do, I decided to add a name generator based on the bot ID.

However, you can disable this by setting the environment variable DISABLE_FUNNY_WORKER_NAMES to true.

Can I invite other people to use the bot?

Yes, you can. There's two methods of doing this, you can either open the bot up to be installed for them as a user app, or you can install it as a guild app.

If you want another user to install it as a user app then you need to create an invite link for them, and then they can install it. See Troubleshooting invites for more information.

Notice

We highly disencourage using more than three bots as this is a "workaround" to bots only being able to create 10 guilds. The risk is on you for using this tool.

About

A Discord bot to easily create testing servers, without having to write in that 2FA code to delete it later

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages