This guide will walk you through the process of setting up the development environment, configuring the bot, and running it on your local machine.
- Bun
- Node.js (for some scripts)
- Git
- Docker and Docker Compose (for the database)
-
Clone the repository:
git clone https://github.com/LibreTurks/usmanagabot.git cd usmanagabot -
Install dependencies:
bun install
-
Set up the database: The project uses a PostgreSQL database, which can be easily run using Docker.
docker-compose up -d
-
Bot Configuration: Create a
bot.jsoncfile in theconfigdirectory by copying the example file:cp config/bot-example.jsonc config/bot.jsonc
Edit
config/bot.jsoncand fill in the required fields:app_id: Your Discord application ID.token: Your Discord bot token.management: IDs for a guild, channel, and user for bot management purposes.
-
Database Configuration: Create a
database.jsoncfile in theconfigdirectory:cp config/database-example.jsonc config/database.jsonc
The default values in
database.jsoncare configured to work with the provideddocker-compose.yml. You shouldn't need to change them unless you are using a different database setup.
Once you have completed the setup and configuration, you can start the bot with the following command:
bun startThe package.json file contains several useful scripts for development:
eslint: Lint the codebase for errors.eslint:fix: Automatically fix linting errors.prettier: Check the formatting of the codebase.prettier:fix: Automatically fix formatting issues.typeorm:migration:create: Create a new database migration.typeorm:migration:generate: Generate a new migration from your entities.typeorm:migration:run: Run all pending migrations.typeorm:migration:revert: Revert the last executed migration.