Cooldowns API Reference#

class lightbulb.cooldowns.CooldownManager(callback: t.Callable[[ctx_base.Context], t.Union[buckets.Bucket, t.Coroutine[t.Any, t.Any, buckets.Bucket]]])[source]#

The cooldown manager for a command.

async add_cooldown(context: ctx_base.Context) None[source]#

Add a cooldown under the given context. If an expired bucket already exists then it will be overwritten.

Parameters:

context (Context) – The context to add a cooldown under.

Returns:

None

Raises:

CommandIsOnCooldown – The command is currently on cooldown for the given context.

async reset_cooldown(context: ctx_base.Context) None[source]#

Reset the cooldown under the given context.

Parameters:

context (Context) – The context to reset the cooldown under.

Returns:

None

cooldowns: MutableMapping[Hashable, Bucket]#

Mapping of a hashable to a Bucket representing the currently stored cooldowns.