Limiter API#
LimiterProto
#
Bases: Protocol
, Generic[ClientT]
A protocol that all limiter hooks should implement. A limiter is simply a special type of hook with added methods.
If you're looking to integrate your own ratelimiter implementation, you should make sure to implement all methods defined here.
Tip
An easy (but not necessary) way to ensure you've implemented all methods is to inherit from this protocol.
__call__
abstractmethod
async
#
__call__(ctx: Context[ClientT]) -> HookResult
Call the limiter with the given context.
Implementations should raise an exception if the limiter is ratelimited
or abort via HookResult
.
PARAMETER | DESCRIPTION |
---|---|
ctx |
The context to evaluate the ratelimit under.
TYPE:
|