| @@ -0,0 +1,30 @@ | |||||
| --- | |||||
| uid: Discord.Commands.PreconditionAttribute | |||||
| seealso: | |||||
| - linkId: Discord.Commands.ParameterPreconditionAttribute | |||||
| remarks: *content | |||||
| --- | |||||
| This precondition attribute can be applied on module-level or | |||||
| method-level for a command. | |||||
| [!include[Remarks(PreconditionAttribute.Remarks.Inclusion.md)]] | |||||
| --- | |||||
| uid: Discord.Commands.ParameterPreconditionAttribute | |||||
| seealso: | |||||
| - linkId: Discord.Commands.PreconditionAttribute | |||||
| remarks: *content | |||||
| --- | |||||
| This precondition attribute can be applied on parameter-level for a | |||||
| command. | |||||
| [!include[Remarks(PreconditionAttribute.Remarks.Inclusion.md)]] | |||||
| --- | |||||
| uid: Discord.Commands.PreconditionAttribute | |||||
| example: [*content] | |||||
| --- | |||||
| // todo: add example | |||||
| @@ -0,0 +1,6 @@ | |||||
| A "precondidtion" in the command system is used to determine if a | |||||
| condition is met before entering the command task. Using a | |||||
| precondidtion may aid in keeping a well-organized command logic. | |||||
| The most common use case being whether a user has sufficient | |||||
| permission to execute the command. | |||||
| @@ -0,0 +1,24 @@ | |||||
| --- | |||||
| uid: Discord.Commands.OverrideTypeReaderAttribute | |||||
| remarks: *content | |||||
| --- | |||||
| This attribute is used to override a command parameter's type reading | |||||
| behaviour. This may be useful when you have multiple custom | |||||
| @Discord.Commands.TypeReader and would like to specify one. | |||||
| --- | |||||
| uid: Discord.Commands.OverrideTypeReaderAttribute | |||||
| examples: [*content] | |||||
| --- | |||||
| The following example will override the @Discord.Commands.TypeReader | |||||
| of @Discord.IUser to `MyUserTypeReader`. | |||||
| ```cs | |||||
| public async Task PrintUserAsync( | |||||
| [OverrideTypeReader(typeof(MyUserTypeReader))] IUser user) | |||||
| { | |||||
| //... | |||||
| } | |||||
| ``` | |||||