@@ -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
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.