Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard

Utility class to convert between Kotlin and Java reflection objects.

Link copied to clipboard
value class RestResult<out T>

Encapsulates a successful outcome or a failure.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val MethodInfo.shortSignature: String
Link copied to clipboard
val MethodInfo.shortSignatureNoSrc: String

Functions

Link copied to clipboard
Link copied to clipboard
fun <T> arrayOfSize(size: Int): ArrayList<T>
Link copied to clipboard
suspend fun <R> RestAction<R>.awaitCatching(): RestResult<R>

Awaits the completion of this RestAction and wraps it in a Result.

Link copied to clipboard
suspend fun <R> RestAction<*>.awaitNull(): R?

Awaits the completion of this RestAction and returns null.

Link copied to clipboard
suspend fun <R> RestAction<R>.awaitOrNullOn(vararg errorResponses: ErrorResponse): R?

Awaits the completion of this RestAction, returns null if one of the provided error responses was thrown.

Link copied to clipboard
Link copied to clipboard
suspend fun RestAction<*>.awaitUnit()

Awaits the completion of this RestAction.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <K, V> MutableMap<K, V>.computeIfAbsentOrNull(key: K, block: (K) -> V): V?

Returns null if the element already exists

Link copied to clipboard
fun <T> Iterable<T>.containsAny(vararg elements: T): Boolean
fun <T> Iterable<T>.containsAny(elements: Iterable<T>): Boolean
Link copied to clipboard
fun <T> RestAction<T>.delay(duration: Duration): RestAction<T>
Link copied to clipboard
@JvmName(name = "deleteDelayedMessage")
fun RestAction<Message>.deleteDelayed(delay: Duration): RestAction<Message>

Deletes the message after the specified delay.

Deletes the original message using the hook after the specified delay.

Link copied to clipboard
inline fun <T : Enum<T>, V> enumMapOf(): EnumMap<T, V>
Link copied to clipboard
inline fun <T : Enum<T>> enumSetOf(): EnumSet<T>
inline fun <T : Enum<T>> enumSetOf(vararg elems: T): EnumSet<T>
Link copied to clipboard
inline fun <T : Enum<T>> enumSetOfAll(): EnumSet<T>
Link copied to clipboard
fun getMissingPermissions(requiredPerms: EnumSet<Permission>, permissionHolder: IPermissionHolder, channel: GuildChannel): Set<Permission>

Computes the missing permissions from the specified permission holder, If you plan on showing them, be sure to use DefaultMessages.getPermission

Link copied to clipboard
fun KFunction<*>.getParameters(parameterNames: List<String>, qualifiedTypes: Boolean): String
Link copied to clipboard
fun KFunction<*>.getSignature(parameterNames: List<String> = listOf(), qualifiedClass: Boolean = false, qualifiedTypes: Boolean = false, returnType: Boolean = false, source: Boolean = true): String
Link copied to clipboard
inline fun <T> RestResult<T>.handle(vararg types: KClass<out Throwable>, block: (Throwable) -> Unit): RestResult<T>
inline fun <T> RestResult<T>.handle(predicate: (Throwable) -> Boolean, block: (Throwable) -> Unit): RestResult<T>

inline fun <T> RestResult<T>.handle(vararg responses: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult<T>

Dismisses the encapsulated error response and runs the given block if it corresponds to an ignored response.

Link copied to clipboard
fun <T> RestResult<T>.ignore(vararg types: KClass<out Throwable>): RestResult<T>

Dismisses the encapsulated exception if it corresponds to an ignored exception.

fun <T> RestResult<T>.ignore(vararg responses: ErrorResponse): RestResult<T>

Dismisses the encapsulated error response if it corresponds to an ignored response.

inline fun <T> RestResult<T>.ignore(predicate: (Throwable) -> Boolean): RestResult<T>

Dismisses the encapsulated exception if it corresponds to an predicate.

Link copied to clipboard
Link copied to clipboard
inline fun <T : Any> Class<*>.isSubclassOf(): Boolean
inline fun <T : Any> KClass<*>.isSubclassOf(): Boolean
fun KClass<*>.isSubclassOf(kClass: KClass<*>): Boolean
Link copied to clipboard
fun KClass<*>.isSubclassOfAny(vararg classes: KClass<*>): Boolean
Link copied to clipboard
inline fun <T : Any> KClass<*>.isSuperclassOf(): Boolean
Link copied to clipboard
fun <T> Iterable<T>.joinAsList(linePrefix: String = " -", transform: (T) -> CharSequence? = null): String
Link copied to clipboard
fun <T> Iterable<T>.joinWithQuote(transform: (T) -> CharSequence? = null): String
Link copied to clipboard
inline fun <T : Any> KotlinLogging.loggerOf(): KLogger
Link copied to clipboard
operator fun Timestamp.minus(duration: Duration): Timestamp
Link copied to clipboard
fun namedDefaultScope(coroutineName: String, executor: Executor, job: Job? = null, errorHandler: CoroutineExceptionHandler? = null, context: CoroutineContext = EmptyCoroutineContext): CoroutineScope
fun namedDefaultScope(name: String, corePoolSize: Int, job: Job? = null, errorHandler: CoroutineExceptionHandler? = null, context: CoroutineContext = EmptyCoroutineContext): CoroutineScope

Creates a CoroutineScope with incremental thread naming, uses getDefaultScope under the hood.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Runs the given block if the result is an error response.

Runs the given block if the result is the specified error response.

Link copied to clipboard

Runs the given block if the result is an ErrorResponseException.

Link copied to clipboard
Link copied to clipboard
operator fun Timestamp.plus(duration: Duration): Timestamp
Link copied to clipboard
fun <K, V> MutableMap<K, V>.putIfAbsentOrNull(key: K, value: V): V?

Returns null if the element already exists

Link copied to clipboard
fun RestAction<*>.queueIgnoring(vararg errorResponses: ErrorResponse)

Queues this REST action while ignoring the provided error responses.

Link copied to clipboard

Reads a resource relative from the calling class.

Link copied to clipboard

Reads a resource relative as a string from the calling class.

Link copied to clipboard
inline fun <T : R, R> RestResult<T>.recover(vararg types: KClass<out Throwable>, block: (Throwable) -> R): RestResult<R>
inline fun <T : R, R> RestResult<T>.recover(predicate: (Throwable) -> Boolean, block: (Throwable) -> R): RestResult<R>

inline fun <T : R, R> RestResult<T>.recover(vararg responses: ErrorResponse, block: (ErrorResponseException) -> R): RestResult<R>

Maps the encapsulated error response using the given function block if it corresponds to an ignored response.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Retrieves a thread by ID.

Link copied to clipboard
suspend fun JDA.retrieveUserOrNull(userId: Long): User?
Link copied to clipboard
inline fun runCatchingResponse(vararg ignoredResponses: ErrorResponse, block: () -> Unit): RestResult<Unit>

Encapsulates the result of the specified function block and dismisses error responses that corresponds to an ignored response, making the Result a success.

Link copied to clipboard
inline fun <T> runCatchingRest(block: () -> T): RestResult<T>

Calls the specified function block and returns its encapsulated result if invocation was successful, catching any Throwable exception that was thrown from the block function execution and encapsulating it as a failure.

Link copied to clipboard
inline fun runIgnoringResponse(vararg ignoredResponses: ErrorResponse, block: () -> Unit)

Runs the specified function block and dismisses error responses that corresponds to an ignored response.

Link copied to clipboard
inline fun <R> runIgnoringResponseOrNull(vararg ignoredResponses: ErrorResponse, block: () -> R): R?

Runs the specified function block and returns null on error responses that corresponds to an ignored response.

Link copied to clipboard

The minimum and maximum amount of values a user can select.

Link copied to clipboard
fun <T> Task<T>.setTimeout(duration: Duration): Task<T>
fun <T> GatewayTask<T>.setTimeout(duration: Duration): Task<T>
Link copied to clipboard
inline fun <R> suppressContentWarning(block: () -> R): R

Temporarily suppresses message content intent warnings

Link copied to clipboard
fun <T : RestAction<*>> T.timeout(duration: Duration): T
Link copied to clipboard
Link copied to clipboard
fun Class<*>.toBoxed(): Class<*>
fun KClass<*>.toBoxed(): KClass<*>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <K, V> Map<K, V>.toImmutableMap(): Map<K, V>
Link copied to clipboard
fun <T> Set<T>.toImmutableSet(): Set<T>
Link copied to clipboard
Link copied to clipboard
fun <R> withResource(url: String, block: (InputStream) -> R): R

Reads a resource relative from the calling class.