Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@discordjs/builders
Advanced tools
@discordjs/builders is a utility package for building and formatting Discord API interactions, such as commands and embeds, in a structured and type-safe manner. It is part of the larger discord.js library ecosystem.
Slash Command Builder
The Slash Command Builder allows you to create and structure slash commands for your Discord bot. This example creates a simple 'ping' command that replies with 'Pong!'.
const { SlashCommandBuilder } = require('@discordjs/builders');
const command = new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!');
console.log(command.toJSON());
Embed Builder
The Embed Builder helps you create rich embed messages with various properties like title, description, and color. This example creates a simple embed with a title, description, and green color.
const { EmbedBuilder } = require('@discordjs/builders');
const embed = new EmbedBuilder()
.setTitle('Sample Embed')
.setDescription('This is an example of an embed')
.setColor(0x00FF00);
console.log(embed.toJSON());
Button Builder
The Button Builder allows you to create interactive buttons for your Discord bot. This example creates a primary button with the label 'Click Me'.
const { ButtonBuilder, ButtonStyle } = require('@discordjs/builders');
const button = new ButtonBuilder()
.setCustomId('primary-button')
.setLabel('Click Me')
.setStyle(ButtonStyle.Primary);
console.log(button.toJSON());
Select Menu Builder
The Select Menu Builder helps you create dropdown menus for your Discord bot. This example creates a select menu with two options.
const { SelectMenuBuilder } = require('@discordjs/builders');
const selectMenu = new SelectMenuBuilder()
.setCustomId('select-menu')
.setPlaceholder('Choose an option')
.addOptions([
{ label: 'Option 1', value: 'option1' },
{ label: 'Option 2', value: 'option2' }
]);
console.log(selectMenu.toJSON());
discord.js is a powerful library for interacting with the Discord API. It provides a comprehensive set of features for building Discord bots, including message handling, event handling, and more. While @discordjs/builders focuses on building and formatting interactions, discord.js offers a broader range of functionalities for bot development.
Eris is another library for interacting with the Discord API. It is known for its performance and scalability, making it suitable for large bots. Eris provides similar functionalities to discord.js but with a different design philosophy. It does not have a dedicated builders package like @discordjs/builders, but it offers similar capabilities through its core library.
discord-interactions is a library specifically designed for handling Discord interactions, such as slash commands and buttons. It provides utilities for validating and responding to interactions. While it offers similar functionalities to @discordjs/builders, it is more focused on the interaction aspect and does not provide the same level of integration with the broader Discord API.
@discordjs/builders
is a utility package for easily building Discord API payloads.
Node.js 16.9.0 or newer is required.
npm install @discordjs/builders
yarn add @discordjs/builders
pnpm add @discordjs/builders
You can find examples of how to use the builders in the Slash Command Builders examples.
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
documentation.
See the contribution guide if you'd like to submit a PR.
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official discord.js Server.
FAQs
A set of builders that you can use when creating your bot
The npm package @discordjs/builders receives a total of 187,958 weekly downloads. As such, @discordjs/builders popularity was classified as popular.
We found that @discordjs/builders demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.