A module to interface with Discord
- Fast
- 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", {
intents: GatewayIntents.All,
});
client.once("ready", () => {
console.log(`${client.user.username} is now online!`);
client.createGlobalApplicationCommand(client.application.id, {
name: "ping",
description: "Responds with 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