{"id":10628,"library":"chrxmaticc-framework","title":"Chrxmaticc Framework","description":"Chrxmaticc Framework is a feature-rich, 'batteries-included' framework for developing Discord bots using `discord.js v14`. As of version 1.4.0, it provides out-of-the-box support for music via Lavalink, AI integration, a user experience (XP) system, and PostgreSQL database persistence, designed to streamline bot development with minimal boilerplate. The framework emphasizes a quick setup, allowing developers to create functional bots with core features in roughly ten lines of code. A significant major release, v2.0.0, is planned or recently released, which introduces a new `ChrxCommandBuilder` for simplified command creation, replacing some of the standard `discord.js` boilerplate. This framework aims for a steady release cadence, providing new features and improvements primarily focused on simplifying common Discord bot functionalities, targeting developers who prefer an opinionated, all-in-one solution rather than assembling individual packages.","status":"active","version":"1.4.0","language":"javascript","source_language":"en","source_url":"https://github.com/Chrxmee-Bits/Chrxmaticc-Framework","tags":["javascript","discord","discord.js","lavalink","music","bot","framework","ai","xp"],"install":[{"cmd":"npm install chrxmaticc-framework","lang":"bash","label":"npm"},{"cmd":"yarn add chrxmaticc-framework","lang":"bash","label":"yarn"},{"cmd":"pnpm add chrxmaticc-framework","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library for interacting with the Discord API. This package is a peer dependency.","package":"discord.js","optional":false}],"imports":[{"note":"While CommonJS `require` is shown in v1.x documentation, ESM `import` is the modern and recommended approach for new projects, especially with Node.js v16+.","wrong":"const { ChrxClient } = require('chrxmaticc-framework');","symbol":"ChrxClient","correct":"import { ChrxClient } from 'chrxmaticc-framework';"},{"note":"Introduced in v2.0.0 to simplify command creation, replacing the need for explicit `SlashCommandBuilder` from `discord.js`. Ensure you are on v2.0.0 or higher to use this.","wrong":"const { ChrxCommandBuilder } = require('chrxmaticc-framework');","symbol":"ChrxCommandBuilder","correct":"import { ChrxCommandBuilder } from 'chrxmaticc-framework';"}],"quickstart":{"code":"require(\"dotenv\").config();\nconst { ChrxClient } = require(\"chrxmaticc-framework\");\n\nconst bot = new ChrxClient({\n  token: process.env.BOT_TOKEN ?? '',\n\n  lavalink: {\n    host: process.env.LAVA_HOST ?? 'localhost',\n    port: parseInt(process.env.LAVA_PORT ?? '2333'),\n    password: process.env.LAVA_PASS ?? 'youshallnotpass',\n    secure: process.env.LAVA_SECURE === 'true',\n  },\n\n  modules: {\n    music: true,\n    xp: true,\n    database: process.env.DATABASE_URL ?? '',\n    ai: {\n      apiKey: process.env.AI_KEY ?? '',\n      model: \"gpt-3.5-turbo\",\n      provider: \"openai\", // or \"anthropic\"\n    },\n  },\n});\n\nbot.start();","lang":"javascript","description":"This setup initializes a ChrxClient instance with full capabilities, including Lavalink music, XP system, PostgreSQL database, and AI integration, all configured via environment variables."},"warnings":[{"fix":"Migrate your command files to use `new ChrxCommandBuilder({...})` syntax as detailed in the v2.0.0 documentation. This involves defining `name`, `description`, `options`, `cooldown`, and the `run` method directly within the builder.","message":"Version 2.0.0 introduces ChrxCommandBuilder, a new API for defining commands which significantly reduces boilerplate compared to discord.js SlashCommandBuilder. Existing v1.x command files using SlashCommandBuilder will need refactoring.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure `LAVA_HOST`, `LAVA_PORT`, `LAVA_PASS` are correctly set in your `.env` file and match your Lavalink server's configuration. Use port 443 with `secure: true` for SSL/TLS connections, otherwise use 2333 (default) with `secure: false`.","message":"Correct Lavalink configuration is crucial for the music module. Common issues include incorrect host/port, mismatched passwords, or secure flag misconfiguration (e.g., using `secure: true` with a non-SSL port).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always use a `.env` file and `require('dotenv').config();` at the very top of your main bot file. Double-check all required environment variables are present and correctly formatted, especially API keys and URLs.","message":"The framework relies heavily on environment variables (e.g., BOT_TOKEN, LAVA_HOST, AI_KEY, DATABASE_URL). Incorrectly set or missing environment variables will lead to runtime errors or module failures.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always install both packages: `npm install chrxmaticc-framework discord.js`.","message":"`discord.js` is a peer dependency, meaning it must be installed separately by the user alongside `chrxmaticc-framework`. Forgetting to install it will result in a 'Cannot find module' error.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure your `.env` file has `BOT_TOKEN=YOUR_DISCORD_BOT_TOKEN` and that `YOUR_DISCORD_BOT_TOKEN` is the correct token from the Discord Developer Portal.","cause":"The `BOT_TOKEN` environment variable is either missing or contains an incorrect Discord bot token.","error":"Error: Invalid token provided."},{"fix":"Verify that your Lavalink server is running and accessible. Check `LAVA_HOST`, `LAVA_PORT`, `LAVA_PASS`, and `LAVA_SECURE` in your `.env` file. Ensure firewall rules allow connection.","cause":"The bot could not establish a connection to the configured Lavalink server.","error":"Lavalink connection failed!"},{"fix":"Run `npm install discord.js` in your project directory.","cause":"The `discord.js` peer dependency has not been installed.","error":"Cannot find module 'discord.js'"},{"fix":"Add `require(\"dotenv\").config();` at the very top of your main bot file (e.g., `index.js` or `bot.js`) to load variables from your `.env` file into `process.env`.","cause":"The `dotenv` package (or equivalent) has not been configured to load environment variables, or the script is running in an environment where `process` is unavailable (e.g., browser without polyfill).","error":"ReferenceError: process is not defined"},{"fix":"Ensure `modules: { ai: { apiKey: process.env.AI_KEY, ... } }` is present in your ChrxClient options and `AI_KEY` is correctly set in your `.env` file.","cause":"The AI module was not enabled in the ChrxClient configuration or the `AI_KEY` environment variable is missing.","error":"TypeError: interaction.client.ai.ask is not a function"}],"ecosystem":"npm"}