Discord.Net/docs/_overwrites/Commands/DontInjectAttribute.Overwrite.md
2024-06-13 17:43:59 +12:00

596 B

uid: Discord.Commands.DontInjectAttribute remarks: *content

The attribute can be applied to a public settable property inside a @Discord.Commands.ModuleBase based class. By applying this attribute, the marked property will not be automatically injected of the dependency. See @Guides.Commands.DI to learn more.


uid: Discord.Commands.DontInjectAttribute example: [*content]

public class MyModule : ModuleBase<SocketCommandContext>
{
    [DontInject]
    public MyService MyService { get; set; }

    public MyModule()
    {
        MyService = new MyService();
    }
}