Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.
/ rocket-djs Public archive

A command and event handler for Discord.js.

License

Notifications You must be signed in to change notification settings

NotM1Dev/rocket-djs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

rocket-djs

rocket-djs is a Discord.js bot handler designed to simplify handling both slash commands and events.

Installation

Using npm

npm install rocket-djs

Using Yarn

yarn add rocket-djs

Using pnpm

pnpm add rocket-djs

Examples

// CommonJS
const { Handler } = require("rocket-djs");
const { Client } = require("discord.js");

const path = require("path");

// ESM and TypeScript
import { Handler } from "rocket-djs";
import { Client } from "discord.js";

import path from "path";

const client = new Client(); // Client options such as intents.

new Handler(client, {
    // It is recommended to use the path library to avoid import issues.
    eventsPath: path.join(__dirname, "events"),
    commandsPath: path.join(__dirname, "commands"),
});

// Replace TOKEN with your bot's token.
client.login(TOKEN)

Example Command

// commands/Misc/ping.js

// export or export default for ESM
// module.exports for CommonJS

// Using SlashCommandBuilder or ContextMenuCommandBuilder
export const data = new SlashCommandBuilder()
    .setName("ping")
    .setDescription("Replies with Pong!");

// Or with JSON:
export const data = {
    name: "ping",
    description: "Replies with Pong!",
    // read more below:
    // https://discord.com/developers/docs/interactions/application-commands#app-mount
};

// The main run function.
export function run(interaction) {
    interaction.reply("Pong!!!");
};

Example Event

// export for ESM
// module.exports for CommonJS

// You can also use export default if you prefer.
export const name = "ready"; // The event name - client.on(name)
export function run(client) {
    // The main run function.
    // Arguments in run are the same as doing client.on(name, ...args)
    console.log(`Logged in as ${client.user.tag}!`);
};

About

A command and event handler for Discord.js.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages