CooldownBucket
Class
Sliding window of a cooldown. acquire() checks and consumes in one step.
from discord_interactions.slash import CooldownBucketConstructor
CooldownBucket( rate: int, per: float, type: CooldownType = CooldownType.USER, bucket_key: Callable[[discord.Interaction], str] | None = None,)| Name | Type | Default | Description |
|---|---|---|---|
rate | int | required | |
per | float | required | |
type | CooldownType | CooldownType.USER | |
bucket_key | Callable[[discord.Interaction], str] | None | None |
Properties
| Name | Type | Description |
|---|---|---|
rate | int | |
per | float | |
type | CooldownType | |
bucket_key | Callable[[discord.Interaction], str] | None |
Methods
acquire
def acquire(interaction: discord.Interaction) -> Tuple[bool, float]check
async def check(interaction: discord.Interaction) -> Tuple[bool, float]trigger
async def trigger(interaction: discord.Interaction) -> Nonereset
async def reset(interaction: discord.Interaction) -> Nonereset_all
def reset_all() -> Noneretry_after
def retry_after(interaction: discord.Interaction) -> float