Setup & Options object

Here is a basic example of how to setup WOKCommands. When calling the constructor you can pass in an options object that configures WOKCommands to how you want.

Here is a simple example with only the essentials to get a bot up and running:

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);

Here is a full example of all options:

Last updated

Was this helpful?