discord-interactions.py

CooldownBucket

Class

Sliding window of a cooldown. acquire() checks and consumes in one step.

from discord_interactions.slash import CooldownBucket

Constructor

CooldownBucket(    rate: int,    per: float,    type: CooldownType = CooldownType.USER,    bucket_key: Callable[[discord.Interaction], str] | None = None,)
NameTypeDefaultDescription
rateintrequired
perfloatrequired
typeCooldownTypeCooldownType.USER
bucket_keyCallable[[discord.Interaction], str] | NoneNone

Properties

NameTypeDescription
rateint
perfloat
typeCooldownType
bucket_keyCallable[[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) -> None

reset

async def reset(interaction: discord.Interaction) -> None

reset_all

def reset_all() -> None

retry_after

def retry_after(interaction: discord.Interaction) -> float

Type a name: create_button, ModalBuilder, cooldown.