๐Ÿš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

djs-builder

Package Overview
Dependencies
Maintainers
2
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

djs-builder

๐ŸŽ‰ Package Update! ๐Ÿฅ - Add option `disabled` to the selectMenu options New features added: - `GetUser`: Easily fetch a user from ID, mention, or even from a reply. ๐Ÿ›  Fixes: - Minor bugs fixed - Improved stability and error handling

npmnpm
Version
0.6.26
Version published
Weekly downloads
280
94.44%
Maintainers
2
Weekly downloads
ย 
Created
Source

Example Image

Typing SVG

Welcome to the Discord Bot Utilities package! ๐Ÿฅ

Table of Contents

๐ŸŽฏ STARTER

Starter provides functionality for initializing and starting a Discord bot ๐Ÿค–.

Features:

  • ๐Ÿ› ๏ธ Handler for slash and prefix commands all in just two lines ๐Ÿ”ฉ
  • ๐Ÿ“œ A list displaying all information(number of commands, events, and comprehensive bot) ๐Ÿ”
  • ๐Ÿงฐ Event handler in just one line ๐ŸŽŠ
  • โš ๏ธ Anti-crash system with error lock ๐Ÿ“ƒ
  • ๐Ÿ”‹ Direct connection with MongoDB ๐Ÿ“ฅ
  • ๐Ÿ“‘ Logging for slash and prefix command usage with comprehensive information ๐Ÿงญ

๐Ÿ’ก Tip: Any option you don't want, just DELETE ๐Ÿ—‘๏ธ the option .

Starter โš™๏ธ
   const { starter } = require("djs-builder");

const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({
  intents: Object.keys(GatewayIntentBits).map((a) => {
    return GatewayIntentBits[a];
  }),
});

// Define starter options
const starterOptions = {
  bot: {
    token: "YOUR_BOT_TOKEN", // [OPTIONAL] Discord bot token
    ownerId: "YOUR_USER_ID",
  },
  terminal: true,
  Status: {
    status: "online", // Required: Bot presence state ['online', 'offline', 'dnd', 'idle', 'Streaming']
    activities: ["Game 1", "Game 2"], // [OPTIONAL] Bot activities
    type: 0, // [OPTIONAL] Bot activity type
    time: 60000, // [OPTIONAL] Activity rotation delay in milliseconds
  },
  database: {
    url: "mongodb://localhost:27017", // Required: MongoDB connection URI
  },

  slash: {
    path: "./path/to/slash_commands", // Required: Path to slash commands
    log: "", // id of log channel
  },
  prefix: {
    path: "./path/to/prefixes", // Required: Path to prefix settings
    prefix: "!", // Required: Default bot prefix
    log: "", // id of log channel
    custom_prefix: {
      id : prefix,
      id : prefix,
    } // select prefix for servers
  },
  events: {
    path: "./path/to/events", // Required: Path to event handlers
  },
  anticrash: {
    url: "https://your.crash.webhook.url", // Required: Webhook URL for crash alerts
    mention_id: "YOUR_USER_ID", // [OPTIONAL] User ID to mention in crash alerts
  },
};

await starter(client, starterOptions);

โš™๏ธ function

  • Easyest โœจ
  • Fastest โšก
  • Clear ๐Ÿงต

Than the discord.js

CreateRow ๐Ÿ”ต

๐Ÿ”ต CreateRow is a utility for managing the creation of Discord Row โœจ.

const { CreateRow } = require('djs-builder');

const actionRow = new CreateRow([

//// for any row add new [] or {}
// for buttom
[
      {
    id: 'button1', //  ID for the button customId
    style: 1,  // style: Primary(1), Secondary(2), Success(3), Danger(4), Link(5)
    label: 'Primary Button',
    emoji: '๐Ÿ˜ƒ',  // Emoji for the button
    enabled: false,  // Whether the button is disabled
  },
  {
    id: 'button2',
    style: 2,
    emoji: '๐Ÿš€',
    enabled: true,
  }
], ///// now it is row 1 for button and you can add more rows
{
    type : "string" /// you can select from ["role" , "user" , "channel" ]
    options : {
        id: "menu", // ID for the select menu customId
        placeholder: "Select an option", // Placeholder text for the select menu
        min: 1, // Minimum number of selected values
        max: 2, // Maximum number of selected values
        data: [ // you shuld add your options (it not work for role , user and channel)
          { name: 'Option 1', id: 'option1', about: 'Description for Option 1', icon: '๐ŸŒŸ' },
          { name: 'Option 2', id: 'option2', about: 'Description for Option 2', icon: '๐Ÿš€' },
          { name: 'Option 3', id: 'option3', about: 'Description for Option 3', icon: '๐Ÿ”—' },
        ],  //// is should not look like this ,you selecit it in next step
        value: "id", // here you can set the value of the selected option ( defult the value is will be index (0,1,2 .....) )
        description: "about", // here you can set the description of the selected option ( defult the description not work )
        label: "name", // here you can set the label of the selected option ( defult the label is (Option 1 , Option 2 , Option 3) )
        emoji: "icon" // here you can set the emoji of the selected option ( defult the emoji not work )

    }
}
]);

CreateBar ๐Ÿงพ

๐Ÿงพ CreateBar it โœจ.

const { CreateBar } = require("djs-builder");

const menu = new CreateBar(0, 100, {
  lenth: 20,
  fill: "โœ…",
  empty: "โŒ",
  partialChar: "โณ",
  showPercent: true,
  left: "[",
  right: "]",
});

you can do any type of bar you want like

createProgressBar(3.7, 5, {
  filledChar: '๐ŸŸฆ',
  emptyChar: 'โฌ›',
  partialChar: '๐ŸŸจ',
  leftEdge: 'โฐ',
  rightEdge: 'โฑ',
  precision: 1
});
// โฐ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸจโฌ›โฑ 74.0%



console.log(createProgressBar(7, 10, {
  length: 20,
  filledChar: '๐Ÿ’š',
  emptyChar: '๐Ÿ–ค',
}));



[๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค] 70%


Wait โฐ

โฐ Wait insted of collecter ๐Ÿคฎ โœจ.

const { Wait } =  require('djs-builder');

const message = await Wait({
    context: message, /// message or interaction
    userId : (message.author.id || interaction.user.id), /// user id
     type: "interaction", /// message to wait message or interaction to wait button/menu or both ๐Ÿ’ช
      time: 30000 /// time in ms
      message_Wait : message /// message of button (for button or both)
       });

log ๐Ÿ“ธ

๐Ÿ“ธ Log For All Discord Events โœจ.

const { log } = require("djs-builder");

module.exports = {
  name: "clientReady",
  async run(client) {
    await log(
      client,
      "YOUR_GUILD_ID", /// your guild id
      "YOUR_CHANNEL_ID" /// your log channel id
    );
  },
};
GetUser ๐Ÿ‘ค

๐Ÿ‘ค Utility function to get a member from a message โœจ.

const data = await GetUser(message);

๐Ÿ“ฆ What does it return?

{
  user: <GuildMember>,        // ๐ŸŽฏ The targeted member
  args: [ "word1", "word2" ]  // โœ๏ธ Remaining args after mention/ID
}

๐Ÿ“Œ How does it detect the user?

  • Mention inside the message

    Example: !ban @Ahmed Breaking rules.

  • User ID directly

    Example: !ban 123456789012345678 Spamming.

  • Reply to someoneโ€™s message

    Reply to a userโ€™s message with: !ban.

๐Ÿ› ๏ธ Example usage (ban command) ๐Ÿšซ

client.on("messageCreate", async (message) => {
  if (!message.content.startsWith("!ban")) return;

  const data = await GetUser(message);
  if (!data) return message.reply("โŒ Couldn't find this user.");

  const member = data.user;
  const reason = data.args.join(" ") || "No reason provided";

  await member.ban({ reason });
  message.reply(`๐Ÿšซ ${member.user.tag} has been banned for: ${reason}`);
});

Contributions

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, feel free to contact us on discord.

Discord Banner

FAQs

Package last updated on 10 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts