Darkcord is a Deno and Node.js module to easily interact with Discord API.
Node.js 16.9.0 or newer is required to installation.
npm install darkcord
yarn add darkcord
pnpm add darkcord
import {
ClientBuilder,
ConnectionType,
GatewayIntentBits,
Events,
Utils
} from "darkcord"
const client = new ClientBuilder("Bot token", {
type: ConnectionType.Gateway,
intents: GatewayIntentBits.Guilds
}).build()
client.on(Events.InteractionCreate, async interaction => {
if (Utils.isChatInputApplicationCommandInteraction(interaction)) {
await interaction.reply({ content: "Pong!" })
}
})
client.connect()
import {
ClientBuilder,
ConnectionType,
GatewayIntentBits,
Events,
Utils
} from "darkcord"
const client = new ClientBuilder("public key", {
type: ConnectionType.Interaction
}).build()
client.on(Events.InteractionCreate, async interaction => {
if (Utils.isChatInputApplicationCommandInteraction(interaction)) {
await interaction.reply({ content: "Pong!" })
}
})
client.connect()