Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@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.
Install with npm / yarn / pnpm:
npm install @discordjs/builders
yarn add @discordjs/builders
pnpm add @discordjs/builders
See Contributing Guide.
Here are some examples for the builders and utilities you can find in this package:
FAQs
A set of builders that you can use when creating your bot
The npm package @discordjs/builders receives a total of 164,938 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.