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.
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.
You only need Docker (and Docker Compose) to self-host this bot.
Test Area comes in a Docker image: ghcr.io/biaw/test-area
, which it makes it really simple to set up using Docker.
- 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.
- The first bot will be your main bot. Set it up like this:
- Copy the
example.env
file to.env
in a new folder, and fill in its values. The first bot token goes inCLIENT_TOKEN
, and the second bot token goes inWORKER_TOKENS
. TheOWNER_ID
is your Discord user ID. The rest is optional. - 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
- Run
docker-compose up -d
in the folder where you saved thedocker-compose.yml
file. - 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.
- You're done! You can now use the bot using the main
/testarea
command.
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.
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.
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.
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
.
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.
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.