CooldownBucket
Classe
Fenêtre glissante d'un cooldown. acquire() vérifie et consomme en une étape.
from discord_interactions.slash import CooldownBucketConstructeur
CooldownBucket( rate: int, per: float, type: CooldownType = CooldownType.USER, bucket_key: Callable[[discord.Interaction], str] | None = None,)| Nom | Type | Défaut | Description |
|---|---|---|---|
rate | int | requis | |
per | float | requis | |
type | CooldownType | CooldownType.USER | |
bucket_key | Callable[[discord.Interaction], str] | None | None |
Propriétés
| Nom | Type | Description |
|---|---|---|
rate | int | |
per | float | |
type | CooldownType | |
bucket_key | Callable[[discord.Interaction], str] | None |
Méthodes
acquire
def acquire(interaction: discord.Interaction) -> Tuple[bool, float]Vérifie et consomme en une étape. Renvoie `(autorisé, attente_en_secondes)`.
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