A module to interface with Discord
- Fast
- Lightweight
- Flexible
- 100% coverage of the Official Discord API Documentation
Node.js v18 or newer required
npm install disgroove
const {
Client,
GatewayIntents,
InteractionType,
InteractionCallbackType,
MessageFlags,
} = require("disgroove");
const client = new Client("B0t.T0k3N");
client.once("ready", () => {
console.log("Logged in as", client.user.username);
client.createGlobalApplicationCommand(client.application.id, {
name: "ping",
description: "Pong!",
});
});
client.on("interactionCreate", async (interaction) => {
if (interaction.type !== InteractionType.ApplicationCommand) return;
if (interaction.data.name === "ping") {
client.createInteractionResponse(interaction.id, interaction.token, {
type: InteractionCallbackType.ChannelMessageWithSource,
data: {
content: "Pong! 🏓",
flags: MessageFlags.Ephemeral,
},
});
}
});
client.connect();
More examples on the GitHub repository For support and more join the Discord server