Class BaseRateLimitAttribute
A base for all the rate limit attributes.
Inheritance
System.Attribute
BaseRateLimitAttribute
Inherited Members
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Module)
System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.GetHashCode()
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
System.Attribute.Match(System.Object)
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Color_Chan.Discord.Commands.Attributes
Assembly: Color-Chan.Discord.Commands.dll
Syntax
public abstract class BaseRateLimitAttribute : InteractionRequirementAttribute
Constructors
| Improve this Doc View SourceBaseRateLimitAttribute(Int32, Int32)
Initializes a new instance of BaseRateLimitAttribute.
Declaration
protected BaseRateLimitAttribute(int max, int resetAfterSeconds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | max | The max amount of time the command could be used during the time period. |
Int32 | resetAfterSeconds | The timeframe in which the command can be used a certain amount of times. |
Methods
| Improve this Doc View SourceCheckRateLimitAsync(IInteractionContext, IServiceProvider, UInt64)
Check whether or not a rate limit has been hit.
Declaration
protected async Task<Result> CheckRateLimitAsync(IInteractionContext context, IServiceProvider services, ulong uniqueId)
Parameters
Type | Name | Description |
---|---|---|
IInteractionContext | context | The IInteractionContext of the current request. |
System.IServiceProvider | services | The service. |
System.UInt64 | uniqueId | A unique ID that will be used to store the rate limit objects. |
Returns
Type | Description |
---|---|
Task<Result> | A Result containing if the rate limit was successfully passed or not. |
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | When the RateLimitInfo is not found after creating it. |