BladeBot is a Discord bot designed for BladeBall clan-servers to manage user applications, warns, and various server events. It is built using TypeScript, Discord.js, and Prisma, and is fully containerized for production deployment.
Allows users to apply for the clan via interactive modals. Applications are validated against Roblox details and stored in the database. Administrators can view pending applications and process them accordingly.
Provides comprehensive warning system with multiple warning types:
- AP Warnings: Issue warnings for members who don't meet AP (Activity Points) requirements
- Donation Warnings: Track members who haven't met donation requirements
- Warning Management: View, list, and remove warnings with detailed information
- Direct Notifications: Members receive DM notifications about warnings with fallback to channel messages
Supports a range of slash commands such as /ping for latency checks, /settings for configuring bot settings (including opening/closing applications), and /embed for sending application embeds.
Automatically assigns clan roles upon application acceptance, updates application statuses, and manages pending invites through interactive buttons.
Tracks repository changes and provides information about the current branch and commit count.
Allows administrators to configure bot settings through the /settings command, including toggling application availability.
-
src/ Contains all source code. Major folders include:
- bot/: Discord bot logic, command and event handlers, slash commands, and stores.
- db/: Prisma client and database schema interactions.
- utils/: Utility classes like the Logger and ConfigManager.
-
env/ Environment variable files for different deployments (e.g.
clan.env). -
schema.prisma Prisma schema file defining the database models.
-
package.json Contains project scripts and dependencies.
- Clone the Repository
Run the following in your terminal:
git clone <repository-url>- Install Dependencies
Install the required packages using npm:
npm install- Environment Configuration
- Create a folder called
envin the root of the project. - Create an environment file (e.g
clan.env). - Fill it with the values of the .env.example file.
- Link the file to your
docker-compose.yamlfile.
- Database Setup
- Create a database.
- Make sure to correctly paste the URL into the
envfile. - The tables will be configured, when the bot runs (database must be empty).
- Prisma Schema
To generate the Prisma schema, run:
npx prisma generate- Emojis
- Upload the emojis from
assets/folder to your Discord bot via the Discord dashboard (https://discord.com/developers/applications/:appId/emojis) - Copy the emoji Markdown (
<:Name:ID>) - Update the emoji strings in emoji.ts with your new emoji
- Docker Deployment
To deploy with Docker, use the provided shell scripts:
-
Start the containers:
sh up.sh
-
To restart the bot:
sh restart.sh
-
To stop the containers:
sh down.sh
-
TypeScript:
The entire project is written in TypeScript. -
Linting & Formatting:
Uses Prettier for code formatting. You can format the code by running:npm run pretty
-
Testing:
Run TypeScript type checks using:npm run test
Contributions are welcome! Please fork the repository, make your changes, and open a pull request.
This project is licensed under the ISC License.