TimesPer Reference#

class cooldowns.CooldownTimesPer(limit: int, time_period: float, _cooldown: Cooldown)#
__init__(limit: int, time_period: float, _cooldown: Cooldown) None#
Parameters:
  • limit (int) – How many items are allowed

  • time_period (float) – The period of seconds limit applies to

  • _cooldown (Cooldown) – A backref to the parent cooldown manager.

Notes

This is an internal object. You do not need to construct it yourself.

property fully_reset_at: datetime | None#

When this bucket is fully reset.

Returns:

When this bucket fully resets.

Return type:

Optional[datetime.datetime]

Notes

This will return None if it is already fully reset.

property has_cooldown: bool#

Is this instance currently tracking any cooldowns?

If this returns False we can safely delete this instance from the Cooldown lookup table.

property next_reset: datetime | None#

When the next window is freed.

Returns:

When the next window is freed.

None if there are no windows.

Return type:

Optional[datetime.datetime]

class cooldowns.StaticTimesPer(limit: int, reset_times: List[datetime.time], _cooldown: Cooldown)#

A cooldown which implements a set amount of cooldown reset times.

__init__(limit: int, reset_times: List[datetime.time], _cooldown: Cooldown) None#
Parameters:
  • limit (int) – How many items are allowed

  • reset_times (List[datetime.time]) – A list of the possible times in the day to reset cooldowns at

  • _cooldown (Cooldown) – A backref to the parent cooldown manager.

Notes

This is an internal object. You do not need to construct it yourself.

get_next_reset(now: datetime) datetime#

Fetches the next possible reset.

static next_datetime(current: datetime, time: time) datetime#