Preconditions serve as a permissions system for your Commands. Keep in
mind, however, that they are not limited to just permissions and can
be as complex as you want them to be.
There are two types of Preconditions you can use:
You may visit their respective API documentation to find out more.
@Discord.Commands ships with several bundled Preconditions for you
to use.
To write your own Precondition, create a new class that inherits from
either PreconditionAttribute or ParameterPreconditionAttribute
depending on your use.
In order for your Precondition to function, you will need to override
the CheckPermissionsAsync method.
If the context meets the required parameters, return
PreconditionResult.FromSuccess, otherwise return
PreconditionResult.FromError and include an error message if
necessary.
[!NOTE]
Visual Studio can help you implement missing members
from the abstract class by using the "Implement Abstract Class"
IntelliSense hint.
[!code-csharpCustom Precondition]