Skip to content

Dynamic Help Menu

Arthur Neuman edited this page Jul 26, 2020 · 3 revisions

Build a help command using the dynamic help menu creator

Every bot needs a help menu. Build a command that generates one from supplied commands in a nice-looking embed.

The agent includes a command to automate this process and can be done like so:

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()

If you don't want to use buildHelp and want to make your own custom help menu, you can

  • use the pages property returned by buildHelp (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