onCooldownIf

inline fun onCooldownIf(key: String, length: Duration, run: () -> Boolean): Boolean

Runs something if no cooldown is active and starts the cooldown only if run returns true.

Return

whether run was executed.

Parameters

key

The key for this cooldown.

length

The length of this cooldown in milliseconds.

run

What to run if this cooldown is complete. Returns whether or not to start the cooldown.