-
Notifications
You must be signed in to change notification settings - Fork 0
Dynamic Help Menu
Arthur Neuman edited this page Jul 26, 2020
·
3 revisions
Every bot needs a help menu. Build a command that generates one from supplied commands in a nice-looking embed.
const {
embed
} = agent.buildHelp({
desc: 'This is a really cool bot that does stuff',
serverCode: 'DjYykuz', // The code of the invite, don't include the URL
color: 3277055, // An integer color to set as the sidebar color. A helpful tool: https://shodor.org/stella2java/rgbint.html
footerImage: 'https://static.thenounproject.com/png/417823-200.png', // An image that represents your prefix
version: '1.2.0', // The version of your bot
}, 1 /* The page of your help menu (automatically 1) */)
// All embed properties (as well as the embed parameter itself) are optional
This builds an embed object that can be sent to Discord.
-
Commands, replacers, and react commands are automatically separated into different pages. If a page is too many characters, it's automatically split.
-
If the resulting number of pages is more than one, a react interface is added in the return (in a handler-friendly format) that has arrows for scrolling the help menu. Accessed via:
const {
options: {
reactInterface
}
} = agent.buildHelp()
- Use an integer color calculator to get a color value for your sidebar.
- use the
pages
property returned bybuildHelp
(Embed supply not needed) - use
Command.info
and compile your command info strings into a help menu
It's generally bad practice to add commands after the agent has been constructed and therefore, the generator does not update with added commands