mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
f9622d3788215cd635548f04ae072fe0fd7937c7
Co-authored-by: jacoobes <jacoobes@users.noreply.github.com>
Handlers. Redefined.
A customizable, batteries-included, powerful discord.js framework to streamline bot development.
📜 Installation
npm install @sern/handler
yarn add @sern/handler
pnpm add @sern/handler
👀 Quick Look
- Support for discord.js v14 and all interactions
- Hybrid commands
- Lightweight and customizable
- ESM, CommonJS and TypeScript support
- A powerful CLI and awesome community-made plugins
👶 Basic Usage
index.js (CommonJS)
// Import the discord.js Client and GatewayIntentBits
const { Client, GatewayIntentBits } = require('discord.js');
// Import Sern namespace
const { Sern } = require('@sern/handler');
// Our configuration file
const { defaultPrefix, token } = require('./config.json');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages
]
});
export const useContainer = Sern.makeDependencies({
build: root => root
.add({ '@sern/client': single(client) })
.add({ '@sern/logger': single(new DefaultLogging()) })
});
//View docs for all options
Sern.init({
defaultPrefix: '!', // removing defaultPrefix will shut down text commands
commands: 'src/commands',
// events: 'src/events' (optional),
containerConfig : {
get: useContainer
}
});
client.login(token);
ping.js (CommonJS)
const { CommandType, commandModule } = require('@sern/handler');
exports.default = commandModule({
name: 'ping',
description: 'A ping pong command',
type: CommandType.Slash,
execute(ctx) {
ctx.reply('pong!');
}
});
See our templates for TypeScript examples and more.
💻 CLI
It is highly encouraged to use the command line interface for your project. Don't forget to view it.
🔗 Links
👋 Contribute
- Read our contribution guidelines carefully
- Pull up on issues and report bugs
- All kinds of contributions are welcomed.
🚈 Roadmap
You can check our roadmap to see what's going to be added or patched in the future.
Languages
TypeScript
100%
