Clean up commands documentation; index
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -16,21 +16,21 @@ Modules serve as a host for commands you create.
|
|||||||
|
|
||||||
To create a module, create a class that you will place commands in. Flag this class with the `[Module]` attribute. You may optionally pass in a string to the `Module` attribute to set a prefix for all of the commands inside the module.
|
To create a module, create a class that you will place commands in. Flag this class with the `[Module]` attribute. You may optionally pass in a string to the `Module` attribute to set a prefix for all of the commands inside the module.
|
||||||
|
|
||||||
### Example:
|
### Example Module
|
||||||
|
|
||||||
[!code-csharp[Modules](samples/module.cs)]
|
[!code-csharp[Modules](samples/module.cs)]
|
||||||
|
|
||||||
### Loading Modules Automatically
|
#### Loading Modules Automatically
|
||||||
|
|
||||||
The Command Service can automatically discover all classes in an Assembly that are flagged with the `Module` attribute, and load them.
|
The Command Service can automatically discover all classes in an Assembly that are flagged with the `Module` attribute, and load them.
|
||||||
|
|
||||||
To have a module opt-out of auto-loading, pass `autoload: false` in the Module attribute.
|
To have a module opt-out of auto-loading, pass `autoload: false` in the Module attribute.
|
||||||
|
|
||||||
Invoke [CommandService.LoadAssembly](Discord.Commands.CommandService#Discord_Commands_CommandService_LoadAssembly) to discover modules and install them.
|
Invoke [CommandService.LoadAssembly](xref:Discord.Commands.CommandService#Discord_Commands_CommandService_LoadAssembly) to discover modules and install them.
|
||||||
|
|
||||||
### Loading Modules Manually
|
#### Loading Modules Manually
|
||||||
|
|
||||||
To manually load a module, invoke [CommandService.Load](Discord.Commands.CommandService#Discord_Commands_CommandService_Load), and pass in an instance of your module.
|
To manually load a module, invoke [CommandService.Load](xref:Discord.Commands.CommandService#Discord_Commands_CommandService_Load), and pass in an instance of your module.
|
||||||
|
|
||||||
### Module Constructors
|
### Module Constructors
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ Alternatively, you can use an @Discord.Commands.IDependencyMap, as shown below.
|
|||||||
|
|
||||||
The Commands Service includes a very basic implementation of Dependency Injection that allows you to have completely custom constructors, within certain limitations.
|
The Commands Service includes a very basic implementation of Dependency Injection that allows you to have completely custom constructors, within certain limitations.
|
||||||
|
|
||||||
## Setup
|
### Setup
|
||||||
|
|
||||||
First, you need to create an @Discord.Commands.IDependencyMap . The library includes @Discord.Commands.DependencyMap to help with this, however you may create your own IDependencyMap if you wish.
|
First, you need to create an @Discord.Commands.IDependencyMap . The library includes @Discord.Commands.DependencyMap to help with this, however you may create your own IDependencyMap if you wish.
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ Finally, pass the map into the `LoadAssembly` method. Your modules will automati
|
|||||||
|
|
||||||
[!code-csharp[DependencyMap Setup](samples/dependency_map_setup.cs)]
|
[!code-csharp[DependencyMap Setup](samples/dependency_map_setup.cs)]
|
||||||
|
|
||||||
## Usage in Modules
|
### Usage in Modules
|
||||||
|
|
||||||
In the constructor of your module, any parameters will be filled in by the @Discord.Commands.IDependencyMap you pass into `LoadAssembly`.
|
In the constructor of your module, any parameters will be filled in by the @Discord.Commands.IDependencyMap you pass into `LoadAssembly`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
# This is the **HOMEPAGE**.
|
# Discord.Net Documentation
|
||||||
Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
|
|
||||||
## Quick Start Notes:
|
Refer to [Guides](guides/) for tutorials on using Discord.Net, or the [API documentation](api/) to review individual objects in the library.
|
||||||
1. Add images to *images* folder if the file is referencing an image.
|
|
||||||
|
**Todo:** Put something meaningful here.
|
||||||
Reference in New Issue
Block a user