Package Exports
- darkcord
Readme
About
Darkcord is a Deno and Node.js module to easily interact with Discord API.
Instalation
Node.js 16.9.0 or newer is required to installation.
npm install darkcord
yarn add darkcord
pnpm add darkcordExample Usage
Gateway Example
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()HTTP Interactions Example
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()