dade481e4edea6b9ad18016163c0c4d26455d5fb
Bot Setup
Prerequisites
- Latest version of Docker (download)
- Latest version of Docker Compose (download)
- Git (download)
- An e621ng instance ready to start
- A discord bot application
If you are on Windows Docker Compose is already included, you do not need to install it yourself. If you are on Linux/MacOS you can probably use your package manager.
Discord application setup
- Create a new application
- Under the "Installation" sidebar
- For "Installation Contexts" select "Guild Install"
- Set the "Install Link" dropdown to "None"
- Under the "OAuth2" sidebar
- Add a redirect to
http://localhost:8000/callback, or where ever your discord bot joiner will be listening
- Add a redirect to
- Under the "Bot" sidebar
- It is recommended to disable "Public Bot"
- Enable "Server Members Intent"
- Enable "Message Content Intent"
- Join the bot to the desired server using the following invite link, but replace the client id with your application's id: https://discord.com/oauth2/authorize?client_id=YOUR_APPLICATION_ID_HERE&scope=bot&permissions=395271335063
Configuration
- Copy the
.env.samplefile and rename it to.env - Enter your bot's token (found on the
Botpage of the application setup) - Enter your application's client secret (found on the
OAuth2page of the application setup) - Enter your bot's client id (application id, found on the
General Informationpage of the application setup) - Enter your discord guild (server) id
- Enter your discord joiner link secret (found in e621ng's
docker-compose.ymlfile, or other environment file, it's passed asDANBOORU_DISCORD_SECRET. It defaults tosuper_secret_for_url_discord) - e621/e926 base url can be the same in development environments, but should be your e621ng's domain. Do not add trailing slashes
- Enter the redis url of your e621ng instance. You may need to expose the port from docker manually in development enviornments. This can be done by adding a
portsmapping to theredisservice in e621ng'sdocker-compose.ymlfile. You should map6379:6379 - Enter your desired port number. It is recommended to leave this at
8000, if you select anything different you will need to map the correct port indocker-compose.yml
Installing dependencies
Run npm i to install all node dependencies. This is required to start the bot.
Starting the bot
e621ng must be up for the bot to start properly and open the connection to the redis database.
In development
You can use npm run dev to run the typescript without compiling. This will watch for changes and restart when they happen.
If desired, you can also build the typescript using npm run build and then subsequently run it using npm run start
In docker
- Run
docker compose buildto build the image - Run
docker compose upto start the bot. Changes to any files, including.envwill require a rebuild
Description
Languages
TypeScript
96.7%
JavaScript
3%
HTML
0.2%
Dockerfile
0.1%