{"id":15102,"library":"eris-command-framework","title":"Eris Command Framework","description":"The Eris Command Framework (version 3.0.0) is a library designed to streamline the creation of command-based bots for the Eris Discord API library. It facilitates defining commands and plugins using TypeScript decorators (`@Command()`) and relies heavily on `reflect-metadata`, `TypeORM` for database interactions, and `Inversify` for dependency injection. The framework's architecture centers around `PluginInterface` and `CommandInterface` concepts. While functional, the project's README explicitly advises users to transition to Eris's native slash commands, indicating that this framework is no longer the recommended or actively developed approach for modern Eris bot development. As such, its release cadence is likely slow or halted, and users should consider alternatives for new projects. Its reliance on specific versions of TypeORM and Inversify can also lead to compatibility challenges with newer versions of those libraries or Eris itself.","status":"deprecated","version":"3.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install eris-command-framework","lang":"bash","label":"npm"},{"cmd":"yarn add eris-command-framework","lang":"bash","label":"yarn"},{"cmd":"pnpm add eris-command-framework","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core Discord API library that this framework extends.","package":"eris","optional":false},{"reason":"Required for TypeScript decorators (e.g., @Command) used by the framework for command discovery.","package":"reflect-metadata","optional":false},{"reason":"Used for database integration and entity management within plugins and commands.","package":"typeorm","optional":false},{"reason":"Often used for logging within the framework's internal operations or by plugins.","package":"winston","optional":true},{"reason":"Core dependency injection container used for managing services and command instances.","package":"inversify","optional":false}],"imports":[{"note":"The library primarily uses named exports and is designed for ESM/TypeScript environments. CommonJS `require` might lead to issues, especially with decorators.","wrong":"const CommandFramework = require('eris-command-framework').CommandFramework;","symbol":"CommandFramework","correct":"import { CommandFramework } from 'eris-command-framework';"},{"note":"The `@Command()` decorator is a named export. Ensure `emitDecoratorMetadata` and `experimentalDecorators` are enabled in `tsconfig.json`.","wrong":"import Command from 'eris-command-framework/decorators/command';","symbol":"Command","correct":"import { Command } from 'eris-command-framework';"},{"note":"Types and interfaces are typically grouped under the `Interfaces` namespace for clarity. This is a named export.","wrong":"import * as Interfaces from 'eris-command-framework/interfaces';","symbol":"Interfaces","correct":"import { Interfaces } from 'eris-command-framework';"},{"note":"Inversify is a peer dependency and its `Container` is a named export.","wrong":"import Container from 'inversify';","symbol":"Container","correct":"import { Container } from 'inversify';"},{"note":"TypeORM's primary connection utility is a named export.","wrong":"import createConnection from 'typeorm';","symbol":"createConnection","correct":"import { createConnection } from 'typeorm';"}],"quickstart":{"code":"import { CommandFramework, Interfaces, types, Command } from 'eris-command-framework';\nimport { Client, Message } from 'eris';\nimport { Container } from 'inversify';\nimport { createConnection, Connection, Entity, PrimaryColumn, Column } from 'typeorm';\nimport 'reflect-metadata'; // Must be imported once at the top level\n\nconst token = process.env.DISCORD_BOT_TOKEN ?? 'YOUR_DISCORD_BOT_TOKEN';\n\n// --- Dummy TypeORM Entity ---\n@Entity()\nclass MyBotEntity {\n    @PrimaryColumn()\n    id!: string;\n\n    @Column()\n    value!: string;\n}\n\n// --- Example Plugin and Command ---\n@Command({\n    name: 'ping',\n    category: 'General',\n    description: 'Responds with pong!',\n    args: []\n})\nclass PingCommand implements Interfaces.CommandInterface {\n    name: string = 'ping';\n\n    async run(message: Message, _args: string[]): Promise<any> {\n        await message.channel.createMessage('Pong!');\n    }\n}\n\nclass MyPlugin implements Interfaces.PluginInterface {\n    name: string = 'MyPlugin';\n    commands: Interfaces.CommandInterface[] = [\n        new PingCommand()\n    ];\n    // You might inject dependencies here using Inversify\n    constructor() {}\n}\n\nasync function bootstrap() {\n    const client = new Client(token);\n    const container = new Container({ defaultScope: 'singleton' });\n\n    const commandFramework = new CommandFramework(container, { prefix: '|' }); // Prefix is required\n\n    const connection: Connection = await createConnection(\n        {\n            type: 'sqlite',\n            database: ':memory:', // Use in-memory for quick demo\n            synchronize: true,\n            entities: [\n                MyBotEntity,\n                ...commandFramework.GetEntities() // Include framework's internal entities\n            ]\n        }\n    );\n\n    container.bind<Connection>(types.Connection).toConstantValue(connection);\n\n    const plugins: Interfaces.PluginInterface[] = [\n        new MyPlugin() // Your array of PluginInterfaces\n    ];\n\n    await commandFramework.Initialize(plugins);\n\n    client.on('ready', () => {\n        console.log('Bot is ready and connected!');\n    });\n\n    client.on('messageCreate', async (message: Message) => {\n        // Check if the message starts with the command prefix\n        if (message.author.bot || !message.content.startsWith(commandFramework.getOptions().prefix)) {\n            return;\n        }\n        await commandFramework.Handle(message);\n    });\n\n    client.on('error', (err: Error) => console.error('Eris client error:', err));\n    client.connect().catch(console.error);\n\n    console.log('Bot is attempting to connect to Discord...');\n}\n\nbootstrap().catch(console.error);\n","lang":"typescript","description":"This quickstart demonstrates how to initialize the Eris Command Framework with a basic Eris bot, configure TypeORM for an in-memory SQLite database, and register a simple 'ping' command within a plugin, showcasing decorator usage and framework setup. It includes necessary imports and minimal Discord bot boilerplate."},"warnings":[{"fix":"For new projects, implement Discord slash commands directly using Eris. For existing projects, consider migrating commands to slash commands or maintaining this framework with caution.","message":"The README explicitly states, 'You should probably just use slash commands now...' This indicates the framework is no longer the recommended solution for new Eris bots and users should transition to native Discord slash commands for future development.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure your project is configured for ESM (e.g., `\"type\": \"module\"` in `package.json`) and use `import` statements. Transpile your code to ESM if targeting Node.js <16 and using `import`.","message":"Version 3.0.0 moved to a full ESM-only distribution. Projects using CommonJS (require()) will experience 'Cannot find module' errors.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Add `\"emitDecoratorMetadata\": true` and `\"experimentalDecorators\": true` to your `compilerOptions` in `tsconfig.json` and ensure `import 'reflect-metadata';` is at the top of your main entry file.","message":"The framework heavily relies on TypeScript decorators and `reflect-metadata`. Misconfiguration of `tsconfig.json` (specifically `emitDecoratorMetadata` and `experimentalDecorators`) will prevent commands from being discovered.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always check the `peerDependencies` in the `eris-command-framework` `package.json` and ensure your project's dependencies align or are compatible. Avoid upgrading peer dependencies without thorough testing.","message":"This framework has tight peer dependencies on specific major versions of `eris`, `typeorm`, `inversify`, and `winston`. Upgrading these peer dependencies in your project without testing against the framework can lead to runtime errors or unexpected behavior.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[{"fix":"Add `import 'reflect-metadata';` to the very top of your application's entry file and ensure `\"emitDecoratorMetadata\": true` and `\"experimentalDecorators\": true` are set in `tsconfig.json`.","cause":"The `reflect-metadata` polyfill was not imported or `emitDecoratorMetadata` is false in `tsconfig.json`.","error":"TypeError: Reflect.getMetadata is not a function"},{"fix":"When creating `new CommandFramework(container, { prefix: '|' })`, ensure the `prefix` property is set in the options object.","cause":"The `prefix` option was not provided when initializing `CommandFramework`.","error":"Error: CommandFramework options must contain a prefix!"},{"fix":"Ensure your project uses `\"type\": \"module\"` in `package.json`, use `import { CommandFramework } from 'eris-command-framework';`, and verify your `tsconfig.json` `module` and `moduleResolution` settings (e.g., `\"module\": \"NodeNext\"`, `\"moduleResolution\": \"NodeNext\"`).","cause":"Attempting to use CommonJS `require()` syntax with an ESM-only package (v3+) or a TypeScript configuration issue preventing module resolution.","error":"Error: Cannot find module 'eris-command-framework' or Cannot find name 'CommandFramework'."},{"fix":"Ensure your entity classes are included in the `entities` array passed to `createConnection()` (e.g., `entities: [MyBotEntity, ...commandFramework.GetEntities()]`). For development, ensure `synchronize: true` is enabled or migrations are run.","cause":"TypeORM entities were not correctly registered with the database connection, or `synchronize: true` was not set/ran during development.","error":"QueryFailedError: SQLITE_ERROR: no such table: my_bot_entity"}],"ecosystem":"npm"}