WOKCommands
Search…
⌃K

Required permissions

You may want your commands to only be ran by users who have specific Discord permissions. This is often useful for administration commands.
Using WOKCommands you can easily specify what Discord permissions users need to run the command:
JavaScript
TypeScript
ping.js
const { PermissionFlagsBits } = require("discord.js");
const { CommandType } = require("wokcommands");
​
module.exports = {
description: "Ping pong command",
​
type: CommandType.BOTH,
​
permissions: [PermissionFlagsBits.Administrator],
​
callback: () => {
return {
content: "Pong!",
};
},
};
ping.ts
import { PermissionFlagsBits } from "discord.js";
import { CommandObject, CommandType, CooldownTypes } from "wokcommands";
​
export default {
description: "Ping pong command",
​
type: CommandType.BOTH,
​
permissions: [PermissionFlagsBits.Administrator],
​
callback: () => {
return {
content: "Pong!",
};
},
} as CommandObject;