Registry / web-framework / eris-command-framework

eris-command-framework

JSON →
library3.0.0jsnpmunverified

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.

npm install eris-command-framework
INSTALL
IMPORT
SIG · ERIS-COMMAND-FRAME
E
eris-command-framework
web-frameworkjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CommandFramework
import { CommandFramework } from 'eris-command-framework';
const CommandFramework = require('eris-command-framework').CommandFramework;
The library primarily uses named exports and is designed for ESM/TypeScript environments. CommonJS `require` might lead to issues, especially with decorators.
Command
import { Command } from 'eris-command-framework';
import Command from 'eris-command-framework/decorators/command';
The `@Command()` decorator is a named export. Ensure `emitDecoratorMetadata` and `experimentalDecorators` are enabled in `tsconfig.json`.
Interfaces
import { Interfaces } from 'eris-command-framework';
import * as Interfaces from 'eris-command-framework/interfaces';
Types and interfaces are typically grouped under the `Interfaces` namespace for clarity. This is a named export.
Container
import { Container } from 'inversify';
import Container from 'inversify';
Inversify is a peer dependency and its `Container` is a named export.
createConnection
import { createConnection } from 'typeorm';
import createConnection from 'typeorm';
TypeORM's primary connection utility is a named export.

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.

import { CommandFramework, Interfaces, types, Command } from 'eris-command-framework'; import { Client, Message } from 'eris'; import { Container } from 'inversify'; import { createConnection, Connection, Entity, PrimaryColumn, Column } from 'typeorm'; import 'reflect-metadata'; // Must be imported once at the top level const token = process.env.DISCORD_BOT_TOKEN ?? 'YOUR_DISCORD_BOT_TOKEN'; // --- Dummy TypeORM Entity --- @Entity() class MyBotEntity { @PrimaryColumn() id!: string; @Column() value!: string; } // --- Example Plugin and Command --- @Command({ name: 'ping', category: 'General', description: 'Responds with pong!', args: [] }) class PingCommand implements Interfaces.CommandInterface { name: string = 'ping'; async run(message: Message, _args: string[]): Promise<any> { await message.channel.createMessage('Pong!'); } } class MyPlugin implements Interfaces.PluginInterface { name: string = 'MyPlugin'; commands: Interfaces.CommandInterface[] = [ new PingCommand() ]; // You might inject dependencies here using Inversify constructor() {} } async function bootstrap() { const client = new Client(token); const container = new Container({ defaultScope: 'singleton' }); const commandFramework = new CommandFramework(container, { prefix: '|' }); // Prefix is required const connection: Connection = await createConnection( { type: 'sqlite', database: ':memory:', // Use in-memory for quick demo synchronize: true, entities: [ MyBotEntity, ...commandFramework.GetEntities() // Include framework's internal entities ] } ); container.bind<Connection>(types.Connection).toConstantValue(connection); const plugins: Interfaces.PluginInterface[] = [ new MyPlugin() // Your array of PluginInterfaces ]; await commandFramework.Initialize(plugins); client.on('ready', () => { console.log('Bot is ready and connected!'); }); client.on('messageCreate', async (message: Message) => { // Check if the message starts with the command prefix if (message.author.bot || !message.content.startsWith(commandFramework.getOptions().prefix)) { return; } await commandFramework.Handle(message); }); client.on('error', (err: Error) => console.error('Eris client error:', err)); client.connect().catch(console.error); console.log('Bot is attempting to connect to Discord...'); } bootstrap().catch(console.error);
Debug
Known issues
deprecatedThe 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.
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.
affects: >=1.0.0
breakingVersion 3.0.0 moved to a full ESM-only distribution. Projects using CommonJS (require()) will experience 'Cannot find module' errors.
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`.
affects: >=3.0.0
gotchaThe framework heavily relies on TypeScript decorators and `reflect-metadata`. Misconfiguration of `tsconfig.json` (specifically `emitDecoratorMetadata` and `experimentalDecorators`) will prevent commands from being discovered.
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.
affects: >=1.0.0
gotchaThis 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.
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.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Reflect.getMetadata is not a function
The `reflect-metadata` polyfill was not imported or `emitDecoratorMetadata` is false in `tsconfig.json`.
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`.
Error: CommandFramework options must contain a prefix!
The `prefix` option was not provided when initializing `CommandFramework`.
fix
When creating `new CommandFramework(container, { prefix: '|' })`, ensure the `prefix` property is set in the options object.
Error: Cannot find module 'eris-command-framework' or Cannot find name 'CommandFramework'.
Attempting to use CommonJS `require()` syntax with an ESM-only package (v3+) or a TypeScript configuration issue preventing module resolution.
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"`).
QueryFailedError: SQLITE_ERROR: no such table: my_bot_entity
TypeORM entities were not correctly registered with the database connection, or `synchronize: true` was not set/ran during development.
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.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
erisrequiredCore Discord API library that this framework extends.
reflect-metadatarequiredRequired for TypeScript decorators (e.g., @Command) used by the framework for command discovery.
typeormrequiredUsed for database integration and entity management within plugins and commands.
winstonoptionalOften used for logging within the framework's internal operations or by plugins.
inversifyrequiredCore dependency injection container used for managing services and command instances.
Agent activity
28 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
eris-command-framework — npm install eris-command-framework · libregistry