WOKCommands
Search…
Built-in help menu
WOKCommands comes with a built-in dynamic help menu that displays all of your commands. This way you don't have to worry about listings all of your commands for your user to know about. The default help menu looks like this:
Users can click on the reaction to view commands in that category like so:
Your bot will need access to the "MANAGE MESSAGES" permission to be able to remove reactions when switching between pages.
You can access all of your commands to create your own help menu like so:
JavaScript
TypeScript
help.js
1
module.exports = {
2
callback: ({ instance }) => {
3
instance.commandHandler.commands.forEach((command) => {
4
console.log(command)
5
})
6
}
7
}
Copied!
help.ts
1
import { ICommand } from 'wokcommands'
2
3
export default {
4
callback: ({ instance }) => {
5
instance.commandHandler.commands.forEach((command) => {
6
console.log(command)
7
})
8
},
9
} as ICommand
Copied!
You can also set the "Display Name" for your bot like so:
JavaScript
TypeScript
index.js
1
const DiscordJS = require('discord.js')
2
const WOKCommands = require('wokcommands')
3
const path = require('path')
4
5
const { Intents } = DiscordJS
6
7
const client = new DiscordJS.Client({
8
// These intents are recommended for the built in help menu
9
intents: [
10
Intents.FLAGS.GUILDS,
11
Intents.FLAGS.GUILD_MESSAGES,
12
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
13
],
14
})
15
16
client.on('ready', () => {
17
new WOKCommands(client, {
18
// The name of the local folder for your command files
19
commandsDir: path.join(__dirname, 'commands')
20
})
21
.setDisplayName('Bot demo')
22
})
23
24
client.login('YOUR TOKEN HERE')
Copied!
index.ts
1
import DiscordJS, { Intents } from 'discord.js'
2
import WOKCommands from 'wokcommands'
3
import path from 'path'
4
5
const client = new DiscordJS.Client({
6
// These intents are recommended for the built in help menu
7
intents: [
8
Intents.FLAGS.GUILDS,
9
Intents.FLAGS.GUILD_MESSAGES,
10
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
11
],
12
})
13
14
client.on('ready', () => {
15
new WOKCommands(client, {
16
// The name of the local folder for your command files
17
commandsDir: path.join(__dirname, 'commands'),
18
// Allow importing of .ts files if you are using ts-node
19
typeScript: true,
20
})
21
.setDisplayName('Bot demo')
22
})
23
24
client.login('YOUR TOKEN HERE')
Copied!
That will then make the title of the embed "Demo Bot Help Menu" like so:
Copy link