1.3.6 • Published 8 months ago

@ad1m/djb v1.3.6

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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 DJBClient class 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/djb

File Structure

DJB follows a structured approach to organizing commands and events.

Events

  • Events are located in the app/events directory.
  • Each event file exports a config object and an execute function.

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/commands directory.
  • Each command file exports a config object and a default execute function. 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.2.0

9 months ago

1.0.0

9 months ago

1.2.4-1

9 months ago

1.2.8

8 months ago

1.2.7

9 months ago

1.2.6

9 months ago

1.2.5

9 months ago

1.2.4

9 months ago

1.2.3

9 months ago

1.2.2

9 months ago

1.2.1

9 months ago

1.0.0-9

9 months ago

1.0.0-8

9 months ago

1.0.0-5

9 months ago

1.3.4-2

8 months ago

1.0.0-7

9 months ago

1.3.4-1

8 months ago

1.0.0-6

9 months ago

1.0.0-1

9 months ago

1.0.0-2

9 months ago

1.0.0-10

9 months ago

1.0.0-11

9 months ago

1.0.0-12

9 months ago

1.0.0-13

9 months ago

1.0.0-14

9 months ago

1.0.0-15

9 months ago

1.0.0-16

9 months ago

1.0.0-17

9 months ago

1.0.0-18

9 months ago

1.0.0-19

9 months ago

1.3.6

8 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.3.1-3

8 months ago

1.3.1-2

8 months ago

1.3.1-1

8 months ago

1.0.0-20

9 months ago

1.0.0-21

9 months ago

1.0.0-22

9 months ago

1.0.0-23

9 months ago

1.0.0-24

9 months ago

1.0.0-25

9 months ago

1.0.0-26

9 months ago

1.0.0-27

9 months ago

1.0.0-28

9 months ago

1.0.0-29

9 months ago

1.3.1-4

8 months ago

1.0.0-30

9 months ago

1.0.0-31

9 months ago

1.2.9

8 months ago

0.1.0-3

1 year ago

0.1.0-2

1 year ago

0.1.0-1

1 year ago

0.1.0-0

1 year ago

0.1.0

1 year ago