djs-helpers
v1.4.3
Published
A package where you can make different djs builders faster
Downloads
24
Readme
Discord.js Shortcuts
A simple package to create Discord.js embeds and buttons with ease, plus simplified message sending utilities.
Installation
Install the package using npm:
npm install djs-helpers
Then import it in your code:
const { embeds, buttons, send, reply, timestamps } = require('djs-helpers');
Message Utilities
Send messages easily with automatic context detection.
Basic Usage
// For messages
send(message, { content: "Hello!" });
reply(message, { content: "This is a reply" });
// For interactions
send(interaction, { content: "Hello!" });
reply(interaction, {
content: "This is a hidden reply",
hide: true
});
// With embeds
send(message, {
embed: embeds.generate({
title: "My Embed",
description: "Description here"
})
});
// With buttons
send(message, {
content: "Click me!",
component: buttons.generate({
label: "Click",
id: "click-me"
})
});
Send/Reply Options
content
- Text content of the messageembed
- Single embed objectembeds
- Array of embed objectscomponent
- Single component (like a button)components
- Array of componentsfile
- Single file attachmentfiles
- Array of file attachmentsattachment
- Single Discord attachmentattachments
- Array of Discord attachmentshide
- (Interactions only) Whether the reply should be hidden
Embeds Helper
Create embeds easily with a simple object structure.
Basic Usage
const myEmbed = embeds.generate({
title: 'My Embed',
description: 'This is a description',
color: 'RED'
});
All Options
title
- Embed title (max 256 characters)description
- Embed description (max 4096 characters)color
- Embed color (name, hex, or decimal)timestamp
- Add current timestamp if truefooterText
- Footer textfooterIcon
- Footer icon URLauthorName
- Author nameauthorIcon
- Author icon URLthumbnail
- Thumbnail image URLimage
- Main image URLfields
- Array or object of fields
Fields Example
// Array format
fields: [
['Field Name', 'Field Value', true], // inline
['Another Field', 'Another Value', false] // not inline
]
// Object format
fields: {
1: ['Field Name', 'Field Value', true],
2: ['Another Field', 'Another Value', false]
}
Embed Example Image
Buttons Helper
Create buttons with automatic action row wrapping.
Basic Usage
const myButton = buttons.generate({
id: 'my-button',
label: 'Click Me',
style: 'PRIMARY'
});
Multiple Buttons
const myButtons = buttons.generate([
{ id: 'button1', label: 'Button 1', style: 'PRIMARY' },
{ id: 'button2', label: 'Button 2', style: 'SECONDARY' }
]);
All Options
id
- Button custom ID (required for non-link buttons)label
- Button text (max 80 characters)style
- Button style (PRIMARY/BLUE, SECONDARY/GREY, SUCCESS/GREEN, DANGER/RED, LINK)disabled
- Whether the button is disabledemoji
- Button emojiurl
- URL for link buttons
Link Button Example
const linkButton = buttons.generate({
label: 'Visit Website',
style: 'LINK',
url: 'https://example.com'
});
Button Example Image
Timestamps Helper
Generate Discord timestamps easily.
Basic Usage
const timestamp = timestamps.generate('02/13/2025', 'SHORT_DATE');
All Formats
SHORT_DATE
- Short date format (e.g., 02/13/2025)LONG_DATE
- Long date format (e.g., February 13, 2025)SHORT_TIME
- Short time format (e.g., 1:11 PM)LONG_TIME
- Long time format (e.g., 1:11:00 PM)SHORT_DATE_TIME
- Short date and time format (e.g., 02/13/2025 1:11 PM)LONG_DATE_TIME
- Long date and time format (e.g., February 13, 2025 1:11 PM)RELATIVE
- Relative time format (e.g., in 2 days)
Color Support
Colors can be specified in multiple formats:
- Named colors (e.g., 'RED', 'BLUE', 'GREEN')
- Hex colors (e.g., '#FF0000')
- Decimal numbers (e.g., 16711680)
Available Named Colors
- Basic Colors: RED, GREEN, BLUE, YELLOW, CYAN, MAGENTA
- Neutrals: BLACK, WHITE, GRAY/GREY
- Metals: GOLD, SILVER, BRONZE
- Additional Colors: PURPLE, ORANGE, PINK, BROWN
- Light Variants: LIGHTBLUE, LIGHTGREEN, LIGHTPINK, etc.
- Dark Variants: DARKBLUE, DARKGREEN, etc.
- Special Colors: NAVY, TEAL, OLIVE, MAROON
- Random Color: RANDOM
Full Documentation
For the full documentation, please visit djs-helpers-docs.vercel.app.
License
MIT © [S3DKing]
Made with ❤️ for Discord.js developers