cooldownMessage
function in meocord/common Since 4.1.0
cooldownMessage(retryAfterMs: number): stringThe wait before a cooldown allows another call, in plain English, such as "Slow down: try again in 12s.": the
message of a CooldownError, for logs and tests.
The answer a caller sees is meocord.cooldown.until instead, with the time the wait ends as a Discord timestamp,
which the reader's client words in their language and counts down; translateError gives it.
Parameters
| Name | Type | Description |
|---|---|---|
retryAfterMs | number | How long until the next call is allowed. |
Returns
stringThe message, in English.
Examples
cooldownMessage(12_000) // 'Slow down: try again in 12s.'
cooldownMessage(90_000) // 'Slow down: try again in 1m 30s.'
cooldownMessage(86_340_000) // 'Slow down: try again in 23h 59m.'