docs: Improved DI documentation (#2407)
This commit is contained in:
16
docs/guides/dependency_injection/samples/modules.cs
Normal file
16
docs/guides/dependency_injection/samples/modules.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
public class MyModule : InteractionModuleBase
|
||||
{
|
||||
private readonly MyService _service;
|
||||
|
||||
public MyModule(MyService service)
|
||||
{
|
||||
_service = service;
|
||||
}
|
||||
|
||||
[SlashCommand("things", "Shows things")]
|
||||
public async Task ThingsAsync()
|
||||
{
|
||||
var str = string.Join("\n", _service.Things)
|
||||
await RespondAsync(str);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user