Bot owner only commands
Some commands should only be available to the bot owners. A perfect example of this is a "status" command that updates the status of your bot. WOKCommands comes with this capability.
Here is how your command file should be setup:
const { CommandType } = require("wokcommands");
const setStatus = (client, status) => {
client.user?.setPresence({
status: "online",
activities: [
{
name: status,
type: ActivityType.Playing,
},
],
});
};
module.exports = {
description: "Sets the bot's status",
type: CommandType.BOTH,
minArgs: 1,
expectedArgs: "<status>",
ownerOnly: true,
callback: ({ client, text }) => {
setStatus(client, text);
return {
content: `Set status to "${text}"`,
};
},
};Whenever we initialize WOKCommands we can pass in any number of IDs for the owner's Discord accounts:
Last updated
Was this helpful?