SharedCooldown
Classe
Cooldown partagé entre plusieurs commandes.
from discord_interactions import SharedCooldownConstructeur
SharedCooldown( name: str, rate: int = 1, per: float = 5.0, type: CooldownType = CooldownType.USER, bucket_key: Callable[[discord.Interaction], str] | None = None,)| Nom | Type | Défaut | Description |
|---|---|---|---|
name | str | requis | |
rate | int | 1 | |
per | float | 5.0 | |
type | CooldownType | CooldownType.USER | |
bucket_key | Callable[[discord.Interaction], str] | None | None |
Propriétés
| Nom | Type | Description |
|---|---|---|
bucket | CooldownBucket | |
name | str | |
rate | int | |
per | float | |
type | CooldownType | |
bucket_key | Callable[[discord.Interaction], str] | None |
Méthodes
apply
def apply(func: Callable) -> CallableExemple
from discord_interactions.slash import SharedCooldown economie = SharedCooldown("economie", rate=5, per=60) @slash.command(description="Solde")@economieasync def solde(ctx): ...