Command initialization method

Some commands may require you to run code when they are loaded. You can use the init() method within your command to handle this type of functionality:

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

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

  init: (client, instance) => {
    console.log("Ping command has been loaded");
  },

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

Last updated