
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Discopic is a series of utilities to make working with discord.js
npm install discopic discord.js
Discopic includes the ability to create slash commands like this
import { attachSlashCommands, createCommand } from "discopic";
const client = new Client(...)
const ping = createCommand({
name: "ping",
description: "Pongs you back",
async execute({ ctx }) {
ctx.reply("pong");
},
});
attachSlashCommands(client, { commands: [ping]})
This handles registering the commands (as well as caching), intercepting the interaction, and parsing the parameters.
const echoCommand = createCommand({
name: "echo",
description: "Echos a message back at you",
parameters: {
message: {
description: "The message to echo back",
type: "string",
},
},
async execute(interaction, { message }) {
await interaction.reply(message)
},
});
You can create subcommands by combine commands into a group.
const commandA = createCommand(...)
const commandB = createCommand(...)
const commandGroup = createCommandGroup({
name: "group",
description: "My custom group",
commands: [commandA, commandB]
})
attachSlashCommands(client, { commands: [commandGroup]})
You can create subcommands by combine commands into a group.
createCommand(
name: "weather",
description: "Gets the weather for a day of the week",
parameters: {
day: {
description: "The day of the week",
type: "string",
autocomplete: true,
},
},
async autocomplete(interaction) {
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
const choices = days.map((day, index) => {
name: day,
value: index,
})
await interaction.respond(choices);
},
async execute(interaction) {
...
}
)
This handles the submission of components by storing an internal list of callbacks and IDs.
A shorthand for creating MessageActionRow
const components = createComponents([button])
// or for multiple rows
const components = createComponents([[dropdown, toggleButton], [submitButton]])
const button = createButton({
title: "click me",
type: "primary";
async onClick(interaction) {
await interaction.reply("You clicked me!!!!!")
}
}),
const embed = createEmbed({
title: "My Embed",
description: "This is my own custom embed"
}),
const dropdown = createStringSelection({
options: [
{ label: "Sad", value: "sad" },
{ label: "Alright", value: "alright" },
{ label: "Good", value: "good" },
],
async onSelect({ interaction, selected }) {
const mood = selected[0];
await interaction.reply(`You are feeling ${mood}`)
},
});
You can generate an invite url using createInviteUrl, this adds the intents the bot was created with.
const url = createInviteUrl(client)
FAQs
A library for creating discord bots easily
We found that discopic 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.