JSPM

  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q58106F
  • License Apache-2.0

A NodeJS and Deno library to interact with the Discord API

Package Exports

  • darkcord

Readme


darkcord


Tests status

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 darkcord

Example 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()