Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.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! ๐Ÿฅ

latest
npmnpm
Version
0.6.33
Version published
Weekly downloads
103
-46.35%
Maintainers
2
Weekly downloads
ย 
Created
Source

Example Image

Typing SVG

Welcome to the ultimate Discord Bot Utilities package! ๐Ÿฅ Boost your Discord bot development with ease, speed, and all-in-one features.

๐Ÿ“‘ Table of Contents

  • ๐ŸŽฏ Starter โ€“ Initialize your bot with commands, events, presence, and more.
  • โš™๏ธ Functions โ€“ Utilities like CreateRow, CreateBar, Wait, and GetUser.
  • โšก Commands & Events โ€“ Easy setup with cooldowns, permissions, logging, and anti-crash.

๐ŸŽฏ STARTER

The starter function is the ultimate initializer for your Discord bot ๐Ÿค–. It handles everything from logging in, loading commands/events, setting the bot presence, anti-crash protection, logging commands usage, and even checking for library updates.

Features:

  • ๐Ÿ› ๏ธ One-line loader for both Slash & Prefix commands ๐Ÿ”ฉ
  • ๐Ÿ“œ Comprehensive terminal info display (commands, events, bot stats) ๐Ÿ“Š
  • ๐Ÿงฐ Event handler loader in one line ๐ŸŽ‰
  • โš ๏ธ Anti-crash system with automatic webhook reporting ๐Ÿ“ƒ
  • ๐Ÿ”‹ MongoDB connection support ๐Ÿ“ฅ
  • ๐Ÿ“‘ Command logger for both Slash and Prefix commands ๐Ÿงญ
  • ๐Ÿ’ก Supports custom prefixes per guild and cooldowns โณ
  • ๐Ÿ”ผ Automatic update checker for djs-builder ๐Ÿ“ฆ

๐Ÿ’ก Tip: Any option you donโ€™t want, just remove it ๐Ÿ—‘๏ธ.

Starter Usage โš™๏ธ
const { starter } = require("djs-builder");
const { Client, GatewayIntentBits } = require("discord.js");

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

// Define starter options
const starterOptions = {
  bot: {
    token: "YOUR_BOT_TOKEN", // ๐Ÿ”‘ Discord bot token
    ownerId: "YOUR_USER_ID", // ๐Ÿ‘ค Bot owner ID
  },
  terminal: true, // ๐Ÿ–ฅ๏ธ Show bot info in terminal

  Status: {
    status: "online", // โœ… Presence state: online, dnd, idle, offline
    activities: ["Game 1", "Game 2"], // ๐ŸŽฎ Multiple activities
    type: 0, // ๐ŸŽญ Activity type: (0=PLAYING, 1=STREAMING, 2=LISTENING, 3=WATCHING)
    time: 60000, // โฑ๏ธ Rotate activities every X ms
    url: "https://twitch.tv/example", // ๐ŸŒ Twitch URL (only required for streaming)
  },

  database: {
    url: "mongodb://localhost:27017", // ๐Ÿ’พ MongoDB connection
  },

  anticrash: {
    url: "https://your.crash.webhook.url", // ๐Ÿšจ Webhook for crash reports
    mention_id: "YOUR_USER_ID", // ๐Ÿ“ฃ Optional: mention user on crash
  },
};

// Start the bot
await starter(client, starterOptions);

๐Ÿ“Œ How Starter Works

1๏ธโƒฃ Bot Login & Status

  • Authenticates the bot using your token ๐Ÿ”‘.
  • Supports multiple rotating activities (e.g., Game 1 โ†’ Game 2 โ†’ โ€ฆ) โฑ๏ธ.
  • Works with all Discord activity types: PLAYING, STREAMING, LISTENING, WATCHING ๐ŸŽญ.
  • Twitch URL is supported for streaming mode ๐ŸŒ.

2๏ธโƒฃ Database Connection

  • Connects automatically to MongoDB ๐Ÿ’พ.
  • Useful for bots with persistent data storage.

3๏ธโƒฃ Anticrash System

  • Catches and logs:

    • unhandledRejection
    • uncaughtException
    • uncaughtExceptionMonitor
    • unhandledRejectionMonitor
    • warning โš ๏ธ
  • Sends error reports to a webhook ๐Ÿšจ.

  • Optionally pings the owner ๐Ÿ“ฃ.

4๏ธโƒฃ Terminal Info

  • Displays colorful and structured information ๐Ÿ–ฅ๏ธ:

    • Bot name, user, guild, and channel counts ๐Ÿ“Š.
    • Owner ID ๐Ÿ‘ค.
    • Database connection status ๐Ÿ’พ.
    • Uptime โณ.
  • Powered by cli-table3 + chalk for a professional CLI look ๐ŸŽจ.

5๏ธโƒฃ Auto Update Checker

  • Monitors new versions of djs-builder automatically ๐Ÿ”„.
  • Sends update notifications to the webhook ๐ŸŽ‰.

6๏ธโƒฃ Bot Files Information

  • Access detailed stats about loaded files directly from the client:

    • Number of prefix commands โšก.
    • Number of slash commands โš”๏ธ.
    • Number of events ๐ŸŽ‰.
  • Available via client.files, useful for debugging or terminal display ๐Ÿ› ๏ธ.

๐Ÿ’ก Tips

  • Flexible: Delete any section you donโ€™t need (anticrash, database, etc.) ๐Ÿ—‘๏ธ.
  • Multi-Status: Add as many activities as you want and let them rotate ๐ŸŽฎ.
  • Safe by Default: Anticrash system ensures your bot wonโ€™t go down easily ๐Ÿ›ก๏ธ.
  • Always Up-to-Date: Automatic update checker keeps your bot running on the latest version โฌ†๏ธ.
  • Transparent: Quickly check how many files your bot has loaded anytime ๐Ÿ“Š.

โš™๏ธ functions

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

Than the discord.js

CreateRow ๐Ÿ”ต

๐Ÿ”ต CreateRow โ€“ Easily create Discord Action Rows with Buttons & Select Menus โœจ

CreateRow is a powerful utility to build Discord Action Rows. It supports:

  • Buttons โœ…
  • Select Menus ๐ŸŽฏ (string, role, user, channel)
  • Advanced options like defaultValues and channelTypes.

๐Ÿ“Œ Example Usage:

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

const actionRow = new CreateRow([
  //// For each new row, use [] for buttons or {} for a select menu

  // ๐Ÿ”น Row #1: Buttons
  [
    {
      id: "button1", // customId for the button
      style: 1, // Button styles: Primary(1), Secondary(2), Success(3), Danger(4), Link(5)
      label: "Primary Button", // Text shown on button
      emoji: "๐Ÿ˜ƒ", // Emoji displayed
      disabled: false, // true = disabled
    },
    {
      id: "button2",
      style: 2,
      emoji: "๐Ÿš€",
      disabled: true, // Button is disabled
    },
  ],

  // ๐Ÿ”น Row #2: Select Menu
  {
    type: "string", // Options: "string" | "role" | "user" | "channel"
    options: {
      id: "menu1", // customId for the select menu
      placeholder: "Select an option",
      min: 1, // Minimum selection
      max: 2, // Maximum selection

      // ๐Ÿ”ธ Data for string select only
      data: [
        {
          name: "Option 1",
          id: "opt1",
          about: "First option",
          icon: "๐ŸŒŸ",
          default: true,
        },
        { name: "Option 2", id: "opt2", about: "Second option", icon: "๐Ÿš€" },
        { name: "Option 3", id: "opt3", about: "Third option", icon: "๐Ÿ”—" },
      ],

      // ๐Ÿ”ธ Map keys
      label: "name", // Which field is the label
      value: "id", // Which field is the value
      description: "about", // Description for each option
      emoji: "icon", // Emoji for each option

      // ๐Ÿ”ธ Extra options
      disabled: false, // Disable the entire menu
      defaultValues: [
        // For role/user/channel menus
        { id: "123456789012345678", type: "user" }, // Pre-selected
      ],
      channelTypes: [0, 2], // Only for ChannelSelectMenu (0 = Text, 2 = Voice)
    },
  },
]);

๐Ÿ“– Explanation

๐Ÿ”น Buttons

  • id โ†’ customId for the button
  • style โ†’ 1: Primary, 2: Secondary, 3: Success, 4: Danger, 5: Link
  • label โ†’ Button text
  • emoji โ†’ Displayed emoji
  • disabled โ†’ true = button is unclickable

๐Ÿ”น Select Menus

  • type โ†’ "string" | "user" | "role" | "channel"

  • id โ†’ customId for menu

  • placeholder โ†’ Text shown before selection

  • min / max โ†’ Min/Max selectable values

  • data โ†’ Options array (for string select only)

    • label โ†’ Visible text
    • value โ†’ Internal value
    • description โ†’ Short description
    • emoji โ†’ Option emoji
    • default โ†’ Pre-selected option
  • disabled โ†’ Disable menu completely

  • defaultValues โ†’ Pre-selected user/role/channel options

  • channelTypes โ†’ Restrict selectable channel types

CreateBar ๐Ÿงพ

๐Ÿงพ CreateBar โ€“ Text-based Progress Bar for Discord โœจ

CreateBar allows you to display a customizable progress bar with optional percentages and partial symbols. Perfect for showing progress, loading, or stats in messages.

๐Ÿ“Œ Basic Example:

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

const bar = new CreateBar(7, 10, {
  length: 20, // Total length of the bar
  fill: "๐Ÿ’š", // Filled portion
  empty: "๐Ÿ–ค", // Empty portion
  partialChar: "๐Ÿ’›", // Partial fill
  showPercent: true, // Show percentage
  left: "โฐ", // Left bracket
  right: "โฑ", // Right bracket
});

console.log(bar);
// Output: โฐ๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’š๐Ÿ’›๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–ค๐Ÿ–คโฑ 70%

๐Ÿ“Œ Another Example with different symbols:

console.log(
  CreateBar(3.7, 5, {
    fill: "๐ŸŸฆ",
    empty: "โฌ›",
    partialChar: "๐ŸŸจ",
    length: 10,
    left: "โฐ",
    right: "โฑ",
    showPercent: true,
  })
);

// Output: โฐ๐ŸŸฆ๐ŸŸฆ๐ŸŸฆ๐ŸŸจโฌ›โฌ›โฌ›โฌ›โฌ›โฌ›โฑ 74%

๐Ÿ“Œ Minimalist example without percentage:

console.log(
  CreateBar(4, 8, {
    fill: "๐Ÿ”ต",
    empty: "โšช",
    showPercent: false,
  })
);

// Output: ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ตโšชโšชโšชโšช

๐Ÿ“Œ Fun Emoji example:

console.log(
  CreateBar(6, 10, {
    length: 12,
    fill: "๐Ÿ”ฅ",
    empty: "โ„๏ธ",
    partialChar: "๐ŸŒŸ",
    showPercent: true,
    left: "ยซ",
    right: "ยป",
  })
);

// Output: ยซ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐ŸŒŸโ„๏ธโ„๏ธโ„๏ธโ„๏ธยป 60%

๐Ÿ”น Options Summary

  • length โ†’ Total number of symbols
  • fill โ†’ Symbol for filled portion
  • empty โ†’ Symbol for empty portion
  • partialChar โ†’ Symbol for partial fill (e.g., half-filled)
  • showPercent โ†’ Show percentage at the end
  • left / right โ†’ Brackets or edges for the bar

๐Ÿ”น Notes

  • Supports fractional values for partial fill
  • Fully customizable with any emoji or character ๐ŸŽจ
  • Great for progress, stats, experience bars, or loading indicators
Wait โฐ

โฐ Wait โ€“ Await messages, buttons, select menus or modals easily โœจ

Wait is a replacement for traditional collectors. It supports:

  • Awaiting messages ๐Ÿ“
  • Awaiting interactions (buttons / select menus) ๐ŸŽ›๏ธ
  • Awaiting modal submissions ๐Ÿ“‹
  • Filtering by user and timeout

๐Ÿ“Œ Example Usage:

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

const response = await Wait({
  context: message, // Message or Interaction object
  userId: message.author.id, // Optional: filter by user
  type: "both", // "message" | "interaction" | "both"
  time: 30000, // Time in ms
  message_Wait: message, // Required if waiting for buttons/selects
});

if (!response) return console.log("โฑ๏ธ Timeout!");
console.log("โœ… Collected:", response);

๐Ÿ”น Options

  • context โ†’ The message or interaction context
  • userId โ†’ Only collect from this user (optional)
  • type โ†’ "message" | "interaction" | "both"
  • time โ†’ Timeout in milliseconds
  • message_Wait โ†’ Message containing buttons/select menus (for interaction/both type)

๐Ÿ”น Notes

  • Supports automatic cleanup of collectors after completion
  • Can return Message, Interaction, or ModalSubmitInteraction
GetUser ๐Ÿ‘ค

๐Ÿ‘ค GetUser โ€“ Fetch a GuildMember easily from a message โœจ

GetUser helps to detect a target member in multiple ways:

  • Mention (@User)
  • User ID (123456789012345678)
  • Reply to another message

๐Ÿ“Œ Example Usage:

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

const data = await GetUser(message);

if (!data) return message.reply("โŒ Could not find the user.");

const member = data.user; // GuildMember object
const args = data.args; // Remaining arguments
const reason = args.join(" ") || "No reason provided";

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

๐Ÿ”น Returns

{
  user: <GuildMember>,  // Targeted member
  args: [ "arg1", "arg2" ] // Remaining message arguments
}

๐Ÿ”น Detection Methods

  • Mention: !ban @Ahmed Spamming
  • User ID: !ban 123456789012345678 Spamming
  • Reply: Reply to user's message with !ban

๐Ÿ”น Notes

  • Automatically handles missing users
  • Returns null if user not found
  • Works in any text channel of the guild
Logging System ๐Ÿ›ก๏ธ

The Logging System is a powerful feature that keeps track of almost everything happening inside your Discord server ๐Ÿ”.
From messages ๐Ÿ“ to channels ๐Ÿ“‚, roles ๐ŸŽญ, invites ๐Ÿ”—, and even voice state changes ๐ŸŽ™๏ธ โ€“ nothing goes unnoticed!

โœจ Features

  • ๐Ÿ“ Messages โ€“ Deleted & edited messages are logged with details.
  • ๐Ÿ“‚ Channels โ€“ Creation, deletion, and updates are tracked.
  • ๐ŸŽญ Roles โ€“ Created, deleted, and updated roles, including member role changes.
  • ๐ŸŽ™๏ธ Voice State โ€“ Joins, leaves, and moves between channels.
  • ๐Ÿ”— Invites โ€“ Created invites & usage tracking.
  • ๐Ÿ˜€ Emojis & Stickers โ€“ Added, removed, or updated.
  • ๐Ÿšจ Audit Log Integration โ€“ Fetches the executor (who did what).
  • ๐ŸŽจ Beautiful Embeds โ€“ Every log is shown in a clean, styled embed with timestamps.

โš™๏ธ Setup Example

Using the log function is very simple โšก.
Just place this code inside an event (like clientReady) to start logging:

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

module.exports = {
  name: "clientReady",
  async run(client) {
    await log(
      client,
      "GUILD_ID", // ๐Ÿ  Guild ID (server)
      "CHANNEL_ID" // ๐Ÿ“ข Channel ID for logs
    );
  },
};

๐Ÿ’ก How It Works

  • โœ… Pass your Client, Guild ID, and Log Channel ID.
  • ๐Ÿ”” Instantly starts tracking events and sending them to the log channel.
  • ๐Ÿงฐ No extra setup required โ€“ plug and play!
Level System ๐Ÿ†

๐Ÿ† Level System โ€“ XP, Levels & Leaderboard

The Level System module lets you track user experience points (XP) in text ๐Ÿ’ฌ and voice ๐ŸŽ™๏ธ, handle level-ups โฌ†๏ธ, and display leaderboards ๐Ÿ…. Perfect for gamifying your Discord server! ๐ŸŽฎโœจ

๐Ÿ“ฆ Module Exports

const { addXP, UserLevel, leaderboard } = require("djs-builder");
  • addXP(userId, guildId, options) โ†’ Adds XP for a user and handles level-ups ๐ŸŽฒ.
  • UserLevel(userId, guildId) โ†’ Fetch a user's XP and level ๐Ÿ‘ค.
  • leaderboard(guildId, type, limit) โ†’ Get top users ๐Ÿ….

๐ŸŽฒ addXP โ€“ Add Experience Points

Adds XP to a user and automatically handles level-ups.

const result = await addXP("USER_ID", "GUILD_ID", {
  type: "text", // "text" ๐Ÿ’ฌ | "voice" ๐ŸŽ™๏ธ
  minXP: 5, // Minimum random XP ๐ŸŸข
  maxXP: 15, // Maximum random XP ๐Ÿ”ต
  amount_add: 10, // Optional: fixed XP ๐Ÿ’Ž
  level_add: 1, // Optional: direct level boost โฌ†๏ธ
});

console.log(result);
/* Example output:
{
  newLevel: 3,
  oldLevel: 2,
  totalXP: 250,
  leveledUp: true
}
*/

๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ UserLevel โ€“ Fetch User Data

Fetch a user's text XP, voice XP, total XP, and current level.

const data = await UserLevel("USER_ID", "GUILD_ID");
console.log(data);
/* Example output:
{
  text: 120 ๐Ÿ’ฌ,
  voice: 50 ๐ŸŽ™๏ธ,
  totalXP: 170 โญ,
  level: 2 โฌ†๏ธ
}
*/

Returns default values if the user is not found.

๐Ÿ… Leaderboard โ€“ Top Users

Get a sorted list of users based on XP or level.

const topUsers = await leaderboard("GUILD_ID", "totalXP", 5);
console.log(topUsers);
/* Example output:
[
  { userId: "123", totalXP: 500, level: 5 },
  { userId: "456", totalXP: 400, level: 4 },
  ...
]
*/

Parameters:

  • guildId โ†’ Server ID ๐Ÿ 
  • type โ†’ "totalXP", "text" ๐Ÿ’ฌ, "voice" ๐ŸŽ™๏ธ, or "level" โฌ†๏ธ. Default = "totalXP"
  • limit โ†’ Number of top users to return ๐Ÿ”ข. Default = 10

โšก Practical Example: messageCreate Event

const { addXP, UserLevel, leaderboard } = require("djs-builder");

module.exports = {
  name: "messageCreate",
  run: async (msg, client) => {
    if (msg.author.bot) return;

    // ๐ŸŽฒ Add XP on every message
    const result = await addXP(msg.author.id, msg.guild.id, {
      type: "text",
      minXP: 5,
      maxXP: 15,
    });

    // ๐ŸŽ‰ Level-up notification
    if (result.leveledUp) {
      msg.channel.send(
        `๐ŸŽŠ ${msg.author} new level **${result.newLevel}** โฌ†๏ธ`
      );
    }

    // ๐Ÿ“Š Check your rank
    if (msg.content === "!rank") {
      const data = await UserLevel(msg.author.id, msg.guild.id);
      msg.reply(`๐Ÿ“ˆ **level ** ${data.level} โฌ†๏ธ โ€“ **XP:** ${data.totalXP} โญ`);
    }

    // ๐Ÿ… Display top users
    if (msg.content === "!top") {
      const lb = await leaderboard(msg.guild.id, "totalXP", 5);
      msg.reply(
        lb
          .map(
            (u, i) =>
              `#${i + 1} <@${u.userId}> โ€“ Lv.${u.level} โฌ†๏ธ (${u.totalXP} โญ)`
          )
          .join("\n")
      );
    }
  },
};

๐Ÿ’ก Notes & Tips

  • ๐Ÿ’ฌ Text XP โ€“ Add XP for messages automatically.
  • ๐ŸŽ™๏ธ Voice XP โ€“ Add XP for voice activity.
  • โฌ†๏ธ Level Up โ€“ Trigger notifications when leveling up.
  • ๐Ÿ… Leaderboard โ€“ Display the top users in server using embeds for better look.
  • ๐ŸŽฎ Gamify your server easily with XP rewards, mini-games, and custom commands.

โšก Commands & Events

๐Ÿ’ก Commands & Events made easy! With djs-builder, handling commands and events is smooth, fast, and fully customizable. You get built-in features like:

  • โš ๏ธ Anti-crash protection โ€“ your bot wonโ€™t crash unexpectedly.
  • โณ Cooldowns โ€“ prevent spam and control usage.
  • ๐Ÿ›ก๏ธ Permissions & owner/dev only checks โ€“ secure your commands.
  • โšก Fast Use & custom prefixes โ€“ run commands easily across guilds.
  • ๐Ÿ“ Logging โ€“ track every command usage for prefix or slash.

Below are all the available properties you can use for your commands and events:

โšก Commands & Events Options

โšก COMMAND OPTIONS (Prefix & Slash)

name: 'string',                // ๐Ÿท๏ธ Command name (required)
aliases: ['string'],           // ๐Ÿ” Alternative names (Prefix only)
description: 'string',         // โœ๏ธ Short description of the command
cooldown: 5,                   // โณ Cooldown in seconds before reusing the command
Permissions: ['ADMINISTRATOR'],// ๐Ÿ›ก๏ธ Required permissions to execute the command
ownerOnly: true,               // ๐Ÿ‘‘ Only server owner can use this command
devOnly: true,                 // ๐Ÿ› ๏ธ Only bot developer can use this command
guildOnly: true,               // ๐Ÿ  Command works only in servers
dmOnly: true,                  // โœ‰๏ธ Command works only in DMs
fastUse: true,                 // โšก Allow command to be executed without prefix (Prefix only)
run: Function,                 // ๐Ÿƒโ€โ™‚๏ธ Main function to run the command
execute: Function,             // ๐Ÿƒโ€โ™‚๏ธ Alternative function to run the command

โšก EVENT OPTIONS

name: 'string',                // ๐Ÿท๏ธ Event name (e.g., messageCreate, guildMemberAdd)
once: true,                    // ๐ŸŽฏ If true, the event will be executed only once
run: Function,                 // ๐Ÿƒโ€โ™‚๏ธ Function to run when the event triggers
execute: Function              // ๐Ÿƒโ€โ™‚๏ธ Alternative function to run the event

๐Ÿ’ก Tip: Use these properties to fully control command behavior, access, and event handling.

๐Ÿ’Œ Support

We welcome contributions! If you have any suggestions, bug reports, or feature requests, feel free to reach out to us on Discord.

๐Ÿ’ฌ Contact Me: <@679036538511687711>

๐ŸŒ Join our Discord:

Discord Banner

FAQs

Package last updated on 26 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