Package-level declarations

Types

Link copied to clipboard
class T4JDurationCoalescingConverter(val longHelp: Boolean = true, shouldThrow: Boolean = false, var validator: <Error class: unknown class><Duration<IsoUnit>> = null) : CoalescingConverter<Duration<IsoUnit>>

Coalescing argument converter for Time4J Duration arguments.

Link copied to clipboard
class T4JDurationConverter(val longHelp: Boolean = true, var validator: <Error class: unknown class><Duration<IsoUnit>> = null) : SingleConverter<Duration<IsoUnit>>

Argument converter for Time4J Duration arguments.

Link copied to clipboard

Object in charge of parsing strings into Durations, using translated locale-aware units.

Link copied to clipboard

Simple object that caches translated time units per locale.

Functions

Link copied to clipboard
fun formatT4JDuration(duration: Duration<IsoUnit>, locale: Locale, relativeTo: PlainTimestamp = PlainTimestamp.nowInSystemTime()): String?

Function in charge of formatting Time4J duration objects into human-readable form, taking locales and translations into account.

Link copied to clipboard
fun GeneralTimestamp<*>.toDiscord(format: TimestampType = TimestampType.Default): String
fun PlainTimestamp.toDiscord(format: TimestampType = TimestampType.Default): String

Format the given PlainTimestamp to Discord's automatically-formatted timestamp format. This will return a String that you can include in your messages, which Discord should automatically format for users based on their locale.

fun Moment.toDiscord(format: TimestampType = TimestampType.Default): String

Format the given Moment to Discord's automatically-formatted timestamp format. This will return a String that you can include in your messages, which Discord should automatically format for users based on their locale.

Link copied to clipboard
suspend fun Duration<IsoUnit>.toHuman(context: CommandContext, relativeTo: PlainTimestamp = PlainTimestamp.nowInSystemTime()): String?
fun Duration<IsoUnit>.toHuman(locale: Locale, relativeTo: PlainTimestamp = PlainTimestamp.nowInSystemTime()): String?

Given a Duration, this function will return a String (or null if it represents less than 1 second).