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
muslnode 18–226 runs
build_error
glibcnode 18–226 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);
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`.
fixAdd `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`.
fixWhen 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.
fixEnsure 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.
fixEnsure 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.
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.