@ad1m/djb v1.3.6
DJB - DiscordJS Bot Library
DJB is a powerful and intuitive library that simplifies Discord bot development using Discord.js. It offers a structured approach to managing events, commands, and client configurations, making bot development easier and more organized.
Features
- Easy-to-use
DJBClientclass for streamlined bot initialization. - Clean file structure for commands and events.
- Built-in support for MongoDB (optional).
- Advanced command and event handling with type safety.
- Fully compatible with the latest version of Discord.js.
Installation
Install DJB using npm:
npm install @ad1m/djbFile Structure
DJB follows a structured approach to organizing commands and events.
Events
- Events are located in the
app/eventsdirectory. - Each event file exports a
configobject and anexecutefunction.
Example Event File: app/events/client-ready.ts
import { log } from "@ad1m/logger";
import { EventConfig, EventExecute } from "@ad1m/djb";
import { Events } from "discord.js";
export const config: EventConfig = {
name: Events.ClientReady,
once: true,
};
const ClientReady: EventExecute<typeof Events.ClientReady> = async (client) => {
log.success("client", `Client is ready @${client.user?.tag}`);
};
export default ClientReady;Commands
- Commands are located in the
app/commandsdirectory. - Each command file exports a
configobject and a defaultexecutefunction. c Example Command File:app/commands/ping.ts
import { CommandConfig, CommandExecute } from "@ad1m/djb";
export const config: CommandConfig = {
description: "Pings the bot",
};
const Ping: CommandExecute = (client, message) => {
message.reply("Pong 🏓!");
};
export default Ping;Usage
Basic Setup
Here is an example of how to set up a bot using DJB:
Index File: index.ts
import { GatewayIntentBits, Partials } from "discord.js";
import { DJBClient } from "@ad1m/djb";
const djbClient = new DJBClient(
{
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Channel],
},
{ mongoDb: true }
);
djbClient.start();Contributions
Contributions are welcome! Feel free to submit issues or pull requests to improve DJB.
License
This project is licensed under the MIT License.
Links
1 year ago
1 year ago
1 year ago
11 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
11 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago