Constructor
new CommandLoader(clientopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
client |
ModzClient
|
<optional> |
Client to use |
Members
commands :Collection.<string, Command>
The loaded commands
- Source:
Type:
-
Collection.<string, Command>
(nullable) commandsPath :string
The path to the commands
- Source:
Type:
-
string
defaultCommands :Array.<string>
The path to the commands
- Source:
Type:
-
Array.<string>
Methods
findCommands(searchStringopt, exactopt) → {Array.<Command>}
Finds all commands that match the search string
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
searchString |
string
|
<optional> |
null | The string to search for |
exact |
boolean
|
<optional> |
false | Whether the search should be exact |
loadCommand(command) → {CommandLoader}
Loads a single command
- Source:
- See:
Parameters:
Name | Type | Description |
---|---|---|
command |
Command
|
function
|
Either a Command instance, or a constructor for one |
Returns:
- Type:
-
CommandLoader
loadCommands(commands) → {CommandLoader}
Loads multiple commands
- Source:
Parameters:
Name | Type | Description |
---|---|---|
commands |
Array.<Command>
|
Array.<function()>
|
An array of Command instances, or constructors |
Returns:
- Type:
-
CommandLoader
loadCommandsIn(options) → {CommandLoader}
Loads all commands in a directory. The files must export a Command class constructor or instance.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
options |
string
|
RequireAllOptions
|
The path to the directory, or a require-all options object |
Returns:
- Type:
-
CommandLoader
loadDefaultCommands(optionsopt) → {CommandLoader}
Loads the default commands
- Source:
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object
|
<optional> |
The object to specify which commands not to register
|
Returns:
- Type:
-
CommandLoader
resolveCommandPath(group, name) → {string}
Resolves a command file path from a command's group ID and memberName
- Source:
Parameters:
Name | Type | Description |
---|---|---|
group |
string
|
The command's group |
name |
string
|
Name of the command |
Returns:
- Type:
-
string
Fully-resolved path to the corresponding command file