This is a fork of the All Rated Extreme Demon List's Manager V2 bot.
Credit to the original developers of that bot for doing all the hard work 🔥
This repository hosts the code for the discord bot made to help record submissions for the All Rated Extreme Demons List. It is used to allow users to submit their records through discord, and to automatically add those records to a github repository that uses the TSL List Template
This bot does not provide any hosting, meaning that you will need to find a way to host it yourself. It is written in TypeScript using discord.js with the CommandKit framework, and stores its data in PostgreSQL through Prisma. You will need NodeJS v24 or higher and a PostgreSQL database. After node has been installed, run npm install in the bot's root directory to install the dependencies (this also generates the Prisma client).
You will then need to create a config file (an example file is provided in example_config.json) and name it config.json in the root directory. It should contain the following:
enableSeparateStaffServer: Enable this if there is a staff discord server for handling records that is not the public discord server. Will be used to fetch the following channels:pendingRecordsID,priorityRecordsID,acceptedRecordsID,deniedRecordsID,archiveRecordsIDenablePriorityRole: Whether or not to enable the priority system. Records from users with a given role will be sent to a separate records channel and should be given priority to.enableWelcomeMessage: Whether or not to send a message when a user joins the server.
clientId: The discord user ID of the bot.guildId: The discord server ID of your public serverstaffGuildId: If separate staff server is enabled, the discord server ID of your staff server
githubOwner: The name of the github account that owns the list repositorygithubRepo: The name of the list repositorygithubDataPath: The path to the data folder from the repository root. If you haven't changed the base TSL Template, it is justdatagithubBranch: The branch to use, in most cases, justmain
priorityRoleID: If the priority system is enabled, the discord ID of the role that gives priority to recordssubmissionLockRoleID: The discord ID of the role that prevents a user from submitting records (= list banned)
pendingRecordsID: The channel ID in which records info and video will be sent for review. Anyone with access to this channel can accept or deny records.priorityRecordsID: Same aspendingRecordsID, but for priority recordsacceptedRecordsID: The channel ID in which, after being accepted, the record info and the moderator who accepted it, will be sent to.deniedRecordsID: The channel ID in which, after being denied, the record info and the moderator who denied it, along with the deny reason, will be sent to.archiveRecordsID: The channel ID where both accepted and denied records will be sent to, with more extensive information.
guildMemberAddID: If welcome messages are enabled, the channel ID in which to send them.
After you have created this config file, rename the .env.example file to .env and edit the values inside:
TOKEN: The discord bot private token. If you do not know what a token is and how to set up a discord bot, refer to this discord.js guideGITHUB_TOKEN: The github token that will allow the bot to fetch data from and make changes to the github repository of the list. To create one, refer to this github pageDATABASE_URL: The connection string of the PostgreSQL database, e.g.postgresql://user:password@localhost:5432/layoutlist
Then create the database tables by running npm run db:deploy.
If you are upgrading from the older SQLite version of the bot, import your existing data before starting the bot for the first time with
npm run db:import-sqlite -- ./data/database.sqlite. The list cache (data/cache.sqlite) doesn't need to be imported, it is rebuilt from the list repository on startup.
Be sure to properly set the command permissions in your discord server settings ("Integrations" tab), so that only staff/admins can use their respective commands. The list of all commands is detailed later on.
To run the bot:
npm run dev: development mode, with hot reloadingnpm run buildthennpm start: production mode
Slash commands are registered automatically when the bot starts, in the public server and (if enabled) the staff server.
The bot can also be run with Docker Compose, which bundles a PostgreSQL database. Create config.json and .env as described above (DATABASE_URL is ignored, the bot always uses the bundled database), then run:
docker compose up -d --build: build and start the database and the bot. Pending migrations are applied automatically before the bot starts.docker compose logs -f bot: follow the bot's output
data/ and logs/ are mounted from the host, and the task schedule is kept in data/commandkit-tasks.db. The database is stored in the pgdata volume; set POSTGRES_USER, POSTGRES_PASSWORD and POSTGRES_DB in .env to change its credentials. To import data from the older SQLite version, run docker compose run --rm migrate npm run db:import-sqlite -- ./data/database.sqlite before starting the bot for the first time.
On Linux hosts the container runs as uid 1000, so
data/andlogs/must be writable by that user (sudo chown -R 1000:1000 data logs).
- Commands live in
src/app/commands/(category)/, and events insrc/app/events/<event name>/(see the CommandKit docs). Prefixing a file with_disables it.- Persistent buttons and modals live in
src/components/and are registered insrc/components/index.ts.- Scheduled tasks live in
src/app/tasks/and use@commandkit/tasks; define them withscheduledTask()fromsrc/lib/tasks.ts. Their schedule is stored incommandkit-tasks.db.- The database schema is in
prisma/schema.prisma. After changing it, runnpm run db:migrate -- --name <change>to create a migration.npm run typecheckandnpm run lintcheck the code.