Guild and Owner-only Commands
Some commands should only work in guilds while some cannot. Some commands should also only be used by a bot developer.
Setting up a guildonly Command
guildonly Commandconst { NoCliCommandType } = require("nocli-handler.js");
/**
* @type {import("nocli-handler.js").ICommand}
*/
const Command = {
guildOnly: true, // <-- Set guildOnly to true
type: NoCliCommandType.Both,
description: "Checks client latency",
callback: ({ client, message, args, text }) => {
return `π Pong! \`${client.ws.ping}ms\``;
}
}
module.exports = Command;import { ICommand, NoCliCommandType } from "nocli-handler.js";
export default {
guildOnly: true, // <-- Set guildOnly to true
description: "Checks client latency",
type: NoCliCommandType.Both,
callback: ({ client, message, args, text }) => {
return `π Pong! \`${client.ws.ping}ms\``;
}
} as ICommand;
End Result:
Setting up a ownerOnly command
ownerOnly command
End Result:
Last updated



