discokit
This package contains everything you need to start building with the Discord API.
Installation
npm i discokit
Basic Example
This is a simple bot that replies "🏓 Pong!"
to any messages with the content
"!ping"
.
import { createClient } from "discokit";
import { GatewayIntent } from "discokit/gateway";
import { replyToMessage } from "discokit/rest";
const client = createClient({
token: "...",
intents: GatewayIntent.GuildMessages,
});
client.gateway.events.on("messageCreate", async (message) => {
if (message.content === "!ping") {
await replyToMessage(message, {
content: "🏓 Pong!",
});
}
});
client.connect();