1.6.4 • Published 2 months ago

darkcord v1.6.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

About

Darkcord is a Node.js module to easily interact with Discord API.

Installation

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 { Client, Constants } from "darkcord";

const GatewayIntentBits = Constants.GatewayIntentBits;
const ClientIntents =
  GatewayIntentBits.Guilds |
  GatewayIntentBits.GuildMessage |
  GatewayIntentBits.MessageContent;

const client = new Client("token", {
  gateway: {
    intents: ClientIntents,
  },
});

client.on("ready", () => {
  console.log(`Connected to Discord Gateway`);
});

client.on("interactionCreate", async (interaction) => {
  if (interaction.isCommand()) {
    await interaction.reply({ content: "Pong!" });
  }
});

client.connect();

HTTP Interactions Example

import { InteractionClient } from "darkcord";

const client = new InteractionClient("public key", {
  rest: {
    token: "token",
  },
  webserver: {
    port: 8080,
  },
});

client.on("connect", () => {
  console.log("Listening on port 8080");
});

client.on("interactionCreate", async (interaction) => {
  if (interaction.isCommand()) {
    await interaction.reply({ content: "Pong!" });
  }
});

client.connect();

Voice

Install voice packages

npm install shoukaku
yarn add shoukaku
pnpm add shoukaku

npm install kazagumo
yarn add kazagumo
pnpm add kazagumo
Spotify
npm install kazagumo-spotify
yarn add kazagumo-spotify
pnpm add kazagumo-spotify
import { Client } from "darkcord";
import { Lava } from "@darkcord/lava";

const Nodes = [
  {
    name: "Node 1",
    url: "localhost:2333",
    auth: "youshallnotpass",
    secure: false,
  },
];

const voicePlugin = Lava({
  nodes: Nodes,
  defaultSearchEngine: "youtube",
});

const client = new Client("token", {
  gateway: {
    intents: YOUR_INTENTS,
  },
  plugins: [voicePlugin],
});

client.lava.lavalink.on("ready", (node) =>
  console.log(`Node ${node} is Ready`),
);

client.lava.on("playerStart", (player) => {
  client.channels.cache.get(player.textId).createMessage({
    content: `Now playing **${track.title}** by **${track.author}**`,
  });
});

client.on("ready", () => console.log("Client is Ready"));

client.connect();

Project Stats

Alt

Useful Links

1.6.4

2 months ago

1.6.3

2 months ago

1.6.2

2 months ago

1.6.1

2 months ago

1.6.0

3 months ago

1.5.9

3 months ago

1.5.8

3 months ago

1.5.7

3 months ago

1.5.6

3 months ago

1.5.5

3 months ago

1.5.4

3 months ago

1.5.3

3 months ago

1.5.1

3 months ago

1.5.0

3 months ago

1.4.9

3 months ago

1.4.6

3 months ago

1.4.8

3 months ago

1.4.7

3 months ago

1.4.5

3 months ago

1.4.4

3 months ago

1.4.3

3 months ago

1.4.2

3 months ago

1.4.1

3 months ago

1.4.0

3 months ago

1.3.5

8 months ago

1.3.4

8 months ago

1.3.3

8 months ago

1.3.2

8 months ago

1.3.1

8 months ago

1.3.0

8 months ago

1.2.9

8 months ago

1.2.8

1 year ago

1.2.7

1 year ago

1.2.6

1 year ago

1.2.5

1 year ago

1.2.0

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.1.1

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.2.5-dev-10.1

1 year ago

0.2.5-dev-10

1 year ago

0.2.5-dev-9

1 year ago

0.2.5-dev-3.1

1 year ago

0.2.5-dev-5.1

1 year ago

0.2.4-dev-4

1 year ago

0.2.4-dev-3

1 year ago

0.2.1

1 year ago

0.2.4-dev-5

1 year ago

0.2.0

1 year ago

0.2.5-dev-5

1 year ago

0.2.5-dev-4

1 year ago

0.2.5-dev-3

1 year ago

0.2.5-dev-2

1 year ago

0.2.3

1 year ago

0.2.5-dev-8

1 year ago

0.2.2

1 year ago

0.2.5-dev-7

1 year ago

0.2.5-dev

1 year ago

0.2.4-dev-2

1 year ago

0.2.5-dev-6

1 year ago

0.2.4-dev-1

1 year ago

0.0.3-alpha

2 years ago

0.0.2-alpha

2 years ago

0.0.1-alpha

2 years ago