SharedCooldown
Class
Cooldown shared between several commands.
from discord_interactions import SharedCooldownConstructor
SharedCooldown( name: str, rate: int = 1, per: float = 5.0, type: CooldownType = CooldownType.USER, bucket_key: Callable[[discord.Interaction], str] | None = None,)| Name | Type | Default | Description |
|---|---|---|---|
name | str | required | |
rate | int | 1 | |
per | float | 5.0 | |
type | CooldownType | CooldownType.USER | |
bucket_key | Callable[[discord.Interaction], str] | None | None |
Properties
| Name | Type | Description |
|---|---|---|
bucket | CooldownBucket | |
name | str | |
rate | int | |
per | float | |
type | CooldownType | |
bucket_key | Callable[[discord.Interaction], str] | None |
Methods
apply
def apply(func: Callable) -> CallableExample
from discord_interactions.slash import SharedCooldown economie = SharedCooldown("economie", rate=5, per=60) @slash.command(description="Solde")@economieasync def solde(ctx): ...Details
economie = SharedCooldown("economie", rate=5, per=60)
@slash.command() @economie.apply async def solde(ctx): ...