/TFA-Utilities

The advanced TypeScript Discord Moderation & Utilities bot made for big public server(s). Fully written in TypeScript and discord.js.

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

T.F.A's Utilities (Open-source version)

T.F.A's Utilities is a powerful and advanced Discord moderation bot built for T.F.A 7524 - Development. This project uses Prisma ORM and discord.js v14, and the main database SQLite. You can change the database to another one (examples: MongoDB, PostgreSQL... etc.) but you need to edit the model in prisma/schema.prisma.

Warning This bot is made for a single-server only. If you make your bot public, you need a huge database and some other configuration for the commands. This bot is NOT made for public servers.

Features

Administration

  • Custom slash (/) commands (5 max)

Auto-moderation

  • Anti-swear
  • Anti-link
  • Anti-Discord server invites
  • Anti-caps
  • Anti-mass mention
  • Anti-walls (number of lines per message)
  • Anti-emoji spam (number of emojis per message)
  • Anti-IP addresses (avoid any IPv4 or/and IPv6 in any message)
  • Message update anti-bypasser (avoid members to bypass automod by editing their messages)

Moderation

  • Auto-mod infractions
  • Infractions
    • Automod
      • 3x warnings: 3h timeout
  • Infractions expiration time
    • Automod
      • Warning: 6h
      • Mute: Permanent
    • Manual
      • Warning: 7d / Permanent
      • Mute: Permanent
      • Ban: Permanent
      • Kick: Permanent
  • Slowmode
  • Channel lock & unlock
  • Server lockdown & unlock
  • Yeet (troll command)
  • Note system
  • Protected moderator roles (avoid staff members to punish other staff members)

Utility

  • AFK system
  • Welcome system & autorole
  • Server & user info
  • Help with mentionable commands & autocomplete options

Setup

  1. Run the following command to initialize a new package:
npm init -y
  1. Install typescript, prisma, and @types/ms as dev dependencies:
npm install --save-dev typescript prisma @types/ms
  1. Run a migration to create your database tables with prisma: (Learn more here)
npx prisma migrate dev --name init
  1. Install other required packages:
npm install @prisma/client aqify.js axios discord.js dotenv ms
  1. Rename .env.example to .env and example.config.ts (in src/) to config.ts, and then fill all required values in each file.

.env:

# The database URL ("file:./dev.db" for SQLite)
DATABASE_URL="file:./dev.db"

# The Discord bot token
CLIENT_TOKEN=""
# The Discord bot ID
CLIENT_ID=""

# The developer ID (You)
OWNER_ID=""

config.ts:

export default {
    lockdown: {
        // The channel IDs to update whenever the server is on lockdown.
        channels: string[]
    },
    moderation: {
        // The role IDs to protect other staff members whenever a staff tries to punish them.
        protectedRoles: string[]
    },
    automod: {
        // The role IDs to ignore people (have at least one of the roles) who breaks the automod rules.
        protectedRoles: string[]
    }
};
  1. Run the following command to compile the TypeScript files into JavaScript files, and then starts from the main file lib/index.js.
npm run build

Developers

License

GPL-3.0, General Public License v3.0