For the complete documentation index, see llms.txt. This page is also available as Markdown.

Ping pong command example

WOKCommands is easy to get setup and working. On this page you will learn how to create a simple "Ping -> Pong" command.

First you must setup WOKCommands in your main file:

index.js
const { Client, IntentsBitField, Partials } = require("discord.js");
const WOK = require("wokcommands");
const path = require("path");
require("dotenv/config");

const client = new Client({
  intents: [
    IntentsBitField.Flags.Guilds,
    IntentsBitField.Flags.GuildMessages,
    IntentsBitField.Flags.DirectMessages,
    IntentsBitField.Flags.MessageContent,
  ],
  partials: [Partials.Channel],
});

client.on("ready", () => {
  new WOK({
    client,
    commandsDir: path.join(__dirname, "commands"),
  });
});

client.login(process.env.TOKEN);

Then create a "commands" folder where you can create a "ping.js" file with the following contents:

After inviting your bot to a Discord server and running !ping ("!" is the default command prefix) or /ping, your bot should reply with Pong!.

Last updated