Last updated 12 months ago
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:
init()
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!", }; }, };
import { Client } from "discord.js"; import WOKCommands, { CommandObject, CommandType } from "wokcommands"; export default { description: "Ping pong command", type: CommandType.BOTH, init: (client: Client, instance: WOKCommands) => { console.log("Ping command has been loaded"); }, callback: () => { return { content: "Pong!", }; }, } as CommandObject;