djs-builder
๐ Package Update! ๐ฅ
Welcome to the ultimate Discord Bot Utilities package! ๐ฅ Boost your Discord bot development with ease, speed, and all-in-one features.
- ๐ฏ 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.
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", // Required: Bot presence state ['online', 'dnd', 'idle', 'offline', 'streaming']
activities: ["Game 1", "Game 2"], // ๐ฎ List of activities
type: 0, // Optional: Activity type (0 = PLAYING, 1 = STREAMING, 2 = LISTENING, 3 = WATCHING)
time: 60000, // โฑ๏ธ Activity rotation delay in ms
url: "https://twitch.tv/example", // Optional: Required only for STREAMING type
},
database: {
url: "mongodb://localhost:27017", // ๐พ MongoDB URI for direct connection
},
slash: {
path: "./path/to/slash_commands", // ๐ Path to slash commands
log: "LOG_CHANNEL_ID", // ๐ Optional: log channel ID for slash commands
},
prefix: {
path: "./path/to/prefixes", // ๐ Path to prefix commands
prefix: "!", // Default prefix
log: "LOG_CHANNEL_ID", // Optional: log channel ID for prefix commands
custom_prefix: {
// โ๏ธ Guild-specific prefixes
GUILD_ID_1: "?",
GUILD_ID_2: "$",
},
},
events: {
path: "./path/to/events", // ๐ Path to event handlers
},
anticrash: {
url: "https://your.crash.webhook.url", // ๐จ Webhook for crash alerts
mention_id: "YOUR_USER_ID", // Optional: Mention this user on crash
},
};
// Start the bot
await starter(client, starterOptions);
- Logs the bot in using the token ๐.
- Sets the presence (status + activities) with automatic rotation โฑ๏ธ.
- Supports multiple activity types (
PLAYING
,STREAMING
,LISTENING
,WATCHING
) ๐ฎ. - Supports Twitch streaming URL if
type = 1
๐.
-
Monitors:
unhandledRejection
uncaughtException
uncaughtExceptionMonitor
unhandledRejectionMonitor
warning
-
Sends errors to a webhook with optional user mention ๐ฃ.
-
Prevents bot from crashing unexpectedly.
-
Displays colorful bot info:
- Bot name, users, guilds, channels
- Number of prefix/slash commands
- Number of events loaded
- Owner & database connection status
- Started time
-
Uses
cli-table3
+chalk
for readable output.
- Checks for new versions of
djs-builder
every hour. - Sends notification to the webhook if a new version is available ๐.
-
Remove any unwanted option: If you donโt need a feature (like
anticrash
ordatabase
), just delete that key ๐๏ธ. -
Custom Prefix: Each server can have its own prefix via
custom_prefix
. -
Fast Use Commands: Allows commands to run without a prefix if
fastUse = true
. - Slash & Prefix Logging: Works for both types of commands.
- 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
andchannelTypes
.
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)
},
},
]);
-
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
-
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.
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%
console.log(
CreateBar(3.7, 5, {
fill: "๐ฆ",
empty: "โฌ",
partialChar: "๐จ",
length: 10,
left: "โฐ",
right: "โฑ",
showPercent: true,
})
);
// Output: โฐ๐ฆ๐ฆ๐ฆ๐จโฌโฌโฌโฌโฌโฌโฑ 74%
console.log(
CreateBar(4, 8, {
fill: "๐ต",
empty: "โช",
showPercent: false,
})
);
// Output: ๐ต๐ต๐ต๐ตโชโชโชโช
console.log(
CreateBar(6, 10, {
length: 12,
fill: "๐ฅ",
empty: "โ๏ธ",
partialChar: "๐",
showPercent: true,
left: "ยซ",
right: "ยป",
})
);
// Output: ยซ๐ฅ๐ฅ๐ฅ๐ฅ๐ฅ๐ฅ๐โ๏ธโ๏ธโ๏ธโ๏ธยป 60%
-
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
- 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
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);
-
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)
- 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
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}`);
{
user: <GuildMember>, // Targeted member
args: [ "arg1", "arg2" ] // Remaining message arguments
}
-
Mention:
!ban @Ahmed Spamming
-
User ID:
!ban 123456789012345678 Spamming
-
Reply:
Reply to user's message with !ban
- 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!
- ๐ 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.
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
);
},
};
- โ 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!
๐ก 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
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
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.
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: