Documentation ¶
Overview ¶
Package help provides the default help command. It is used to create help messages that can list all commands and modules, commands and modules in a specific module, and details about a command.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BaseEmbed = msgbuilder.NewEmbed().
WithColor(0x6eb7b1)
Functions ¶
func DefaultArgFormatter ¶
Types ¶
type ArgFormatter ¶
type Help ¶
type Help struct { command.LocalizedMeta bot.MiddlewareManager Options }
Help is the default help command. It should fully suffice for most bots, however, it is limited to the same restrictions any embed has. Particularly, the following rules apply:
You can have at most 23 top-level modules and any amount of top-level commands, or 24 top-level modules and no top-level commands.
The total amount characters used for listing all top-level commands, as well as the commands of individual modules, may not exceed 1024. Otherwise, another embed field will be used, which means the number of allowed top-level modules shrinks by one.
The total amount of characters of the embed cannot exceed 6000. A few of those are already taken, to display title and prefixes.
Note also that some commands may be cut off, in order to stay within that character limit.
type HiddenLevel ¶
type HiddenLevel uint8
const ( // Show is the HiddenLevel used if the command should be shown. Show HiddenLevel = iota // HideList is the HiddenLevel used if the command should be hidden from // command lists, i.e. from the general help page, and it's parent // module's help pages, if it has any. // // It will still be shown, if directly requesting it. HideList // Hide is the HiddenLevel used if the command should not be shown at all, // i.e. neither through command lists nor if asking directly for it. Hide )
func (HiddenLevel) Allows ¶
func (a HiddenLevel) Allows(b HiddenLevel) bool
Allows checks if this HiddenLevel would allow a plugin with the given HiddenLevel to be shown.
type HideFunc ¶
type HideFunc func(plugin.ResolvedCommand, *state.State, *plugin.Context) HiddenLevel
func CheckChannelTypes ¶
func CheckChannelTypes(lvl HiddenLevel) HideFunc
CheckChannelTypes returns a HideFunc that checks if the commands plugin.ChannelTypes match those of the invoking channel, and returns the passed HiddenLevel if not.
If an error occurs, it will be handled silently and Show will be returned.
func CheckHidden ¶
func CheckHidden(lvl HiddenLevel) HideFunc
CheckHidden returns a HideFunc that returns the passed HiddenLevel, if the checked command is marked as Hidden.
func CheckRestrictions ¶
func CheckRestrictions(lvl HiddenLevel) HideFunc
CheckRestrictions returns a HideFunc that returns the passed HiddenLevel, if the checked command is restricted. If plugin.ResolvedCommand.IsRestricted returns an error that fulfills errors.As(err, **plugin.RestrictionError) and that is fatal, lvl is returned. Otherwise, Show is returned.
type Options ¶
type Options struct { // HideFuncs are the functions used to determine the HiddenLevel of a // command. // The highest HiddenLevel returned by any the functions will be used. // Invalid HiddenLevels will default to Hide. // // Modules may also be hidden as a result of this, if all their commands // are hidden. // If that is the case, the lowest HiddenLevel any subcommand of the module // has, will be used for that module. // // Defaults to: // []HideFunc{ // CheckHidden(HideList), CheckChannelTypes(HideList), // CheckRestrictions(HideList), // } // // Use an empty slice to always show commands. HideFuncs []HideFunc // NoPrefix toggles whether in a guild the all embed should list the // available prefixes. NoPrefix bool // Aliases are the aliases of the help command. // // Defaults to []string{"h", "how"}. // Use an empty slice to use no aliases. Aliases []string // ArgFormatter is the plugin.ArgFormatter used to generate command usages. // // Defaults to DefaultArgFormatter ArgFormatter ArgFormatter }