nexcord
v1.0.0
Published
A modern TypeScript framework built on top of Discord.js with support for modules, events, prefix commands, slash commands, decorators, and automatic discovery.
Maintainers
Readme
🚀 Discord Framework
A modern TypeScript framework built on top of Discord.js that provides a clean, module-based architecture for Discord bots.
Features
- ⚡ Built with TypeScript
- 🧩 Module-based architecture
- 🎯 Slash Commands
- 💬 Prefix Commands
- 🎧 Event System
- 📂 Automatic Module Discovery
- 🔥 Decorator Support
- 📦 Lightweight & Fast
- 🛠 Discord.js Powered
Installation
npm install nexcordor
yarn add nexcordQuick Start
Create Application
import { Bot } from "nexcord";
import ReadyModule from "./modules/ready";
import PingModule from "./modules/ping";
import HelpModule from "./modules/help";
@Bot({
token: process.env.TOKEN!,
options: {
intents: [],
},
registerCommands: true,
modules: [ReadyModule, PingModule, HelpModule],
})
export class App {}Module Registration
Every feature in the framework is represented as a Module.
import { Module } from "nexcord";
@Module({
type: "slash-command",
path: __dirname,
})
export default class HelpModule {}Folder Structure
src/
│
├── modules/
│ │
│ ├── help/
│ │ ├── module.ts
│ │ ├── index.ts
│ │ ├── user.sup.ts
│ │ └── server.sup.ts
│ │
│ ├── ping/
│ │ ├── module.ts
│ │ └── index.ts
│ │
│ └── ready/
│ ├── module.ts
│ └── index.ts
│
└── app.tsEvents
Module
@Module({
type: "event",
path: __dirname,
})
export default class ReadyModule {}Event File
import { Client } from "discord.js";
export default class ReadyEvent {
name = "clientReady";
once = true;
async run(client: Client) {
console.log(`Logged in as ${client.user?.tag}`);
}
}Prefix Commands
Module
@Module({
type: "command",
path: __dirname,
})
export default class PingModule {}Command File
import { Message } from "discord.js";
import type {ICommand} from "nexcord"
export default class PingCommand implements ICommand {
name = "ping";
prefix = "!";
async run(client, message: Message) {
await message.reply("Pong!");
}
}Usage:
!pingSlash Commands
Module
@Module({
type: "slash-command",
path: __dirname,
})
export default class HelpModule {}Main Command
import type { ISlash } from "nexcord"
export default class HelpCommand implements ISlash {
data = {
name: "help",
description: "display help menu",
};
async run(client, interaction) {
await interaction.reply("Help Menu");
}
}Sub Commands
File name must end with:
.sup.tsExample:
user.sup.tsimport type { ISlash } from "nexcord"
export default class UserSubCommand {
data = {
name: "user",
description: "User help",
};
async run(client, interaction) {
await interaction.reply("User Help");
}
}Automatic Discovery
The framework automatically:
- Loads the module folder
- Finds
index.ts - Loads all
*.sup.tsfiles - Registers slash commands
- Registers events
- Registers prefix commands
No manual registration required.
Module Types
| Type | Description | | ------------- | -------------------- | | event | Discord Events | | command | Prefix Commands | | slash-command | Application Commands |
Example Project Structure
modules/
│
├── moderation/
│ ├── module.ts
│ ├── index.ts
│ ├── ban.sup.ts
│ ├── kick.sup.ts
│ └── mute.sup.ts
│
├── utility/
│ └── index.ts
│
└── ready/
├── module.ts
└── index.tsRequirements
- Node.js 20+
- Discord.js v14+
- TypeScript 5+
License
MIT License
Made with ❤️ for Discord Developers.
