WOKCommands
  • WOKCommands Documentation
  • Useful Links
    • Setup & Options object
    • 🧠 Build a website dashboard, monetize your bot, and get more users
    • 💰 $100 in FREE Hosting Credits
    • 🙋‍♂️ Support Server
    • 📺 YouTube Channel
  • Commands
    • Ping pong command example
    • Command properties
    • Correct argument usage
    • Command initialization method
    • Bot owner only commands
    • Test servers
    • Cooldowns
    • Required permissions
    • Slash commands
    • Inferred slash command arguments
    • Custom slash command arguments
    • Autocomplete
  • Command Validations
    • Validation setup
    • Runtime validations
    • Syntax validations
  • Event Handler
    • Event Handling
    • Dynamic Validations
  • Features
    • Features
  • Built-in commands and features
    • Enabling and disabling commands
    • Configurable required roles
    • Configurable required permissions
    • Per-guild prefixes
    • Customizable channel specific commands
    • Custom commands
Powered by GitBook
On this page

Was this helpful?

  1. Commands

Test servers

PreviousBot owner only commandsNextCooldowns

Last updated 1 year ago

Was this helpful?

You may want some commands to only be enabled in specific servers/guilds for testing. This will give you a good idea if something is working in a production environment without risking bugs for your other users.

You can easily specify a command as a "test only" command like so:

ping.js
const { CommandType } = require("wokcommands");

module.exports = {
  description: "Ping pong command",

  type: CommandType.BOTH,

  testOnly: true,

  callback: () => {
    return {
      content: "Pong!",
    };
  },
};
ping.ts
const { CommandType } = require("wokcommands");

module.exports = {
  description: "Ping pong command",

  type: CommandType.BOTH,

  testOnly: true,

  callback: () => {
    return {
      content: "Pong!",
    };
  },
};

You can then specify any amount of server/guild IDs when initializing WOKCommands like so:

index.js
const path = require("path");
const WOK = require("wokcommands");
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", () => {
  console.log("The bot is ready");

  new WOK({
    client,
    commandsDir: path.join(__dirname, "commands"),
    testServers: ["Server_id_here"],
  });
});

client.login(process.env.TOKEN);
index.ts
import { Client, IntentsBitField, Partials } from "discord.js";
import path from "path";
import WOK from "wokcommands";
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", () => {
  console.log("The bot is ready");

  new WOK({
    client,
    commandsDir: path.join(__dirname, "commands"),
    testServers: ["Server_id_here"],
  });
});

client.login(process.env.TOKEN);