Package-level declarations

Functions

Link copied to clipboard
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(ignored: ErrorResponse, 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 <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> RestResult<T>.handle(predicate: (Throwable) -> Boolean, block: (Throwable) -> Unit): RestResult<T>

Dismisses the encapsulated exception and runs the given block if it matches the predicate.

inline fun <T> RestResult<T>.handle(type: KClass<out Throwable>, vararg types: KClass<out Throwable>, block: (Throwable) -> Unit): RestResult<T>

Dismisses the encapsulated exception and runs the given block if it corresponds to an ignored exception type.

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

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

Link copied to clipboard
inline fun <T> RestResult<T>.ignore(predicate: (Throwable) -> Boolean): RestResult<T>

Dismisses the encapsulated exception if it corresponds to the predicate.

fun <T> RestResult<T>.ignore(ignored: KClass<out Throwable>, vararg types: KClass<out Throwable>): RestResult<T>

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

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

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

Link copied to clipboard
operator fun Timestamp.minus(duration: Duration): Timestamp
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
operator fun Timestamp.plus(duration: Duration): Timestamp
Link copied to clipboard
fun RestAction<*>.queueIgnoring(ignored: ErrorResponse, vararg errorResponses: ErrorResponse)

Queues this REST action while ignoring the provided error responses.

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

Maps the encapsulated exception using the given block if it corresponds to the predicate.

inline fun <T : R, R> RestResult<T>.recover(type: KClass<out Throwable>, vararg types: KClass<out Throwable>, block: (Throwable) -> R): RestResult<R>

Maps the encapsulated exception using the given block if it corresponds to an ignored exception type.

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

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

Link copied to clipboard

Retrieves a Ban of the provided UserSnowflake, or null if the user is not banned.

Link copied to clipboard
suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: Long): Entitlement?
suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: String): Entitlement?

Retrieves an Entitlement from the provided ID, see JDA.retrieveEntitlementById for more details.

Link copied to clipboard
suspend fun Guild.retrieveMemberByIdOrNull(userId: Long, useCache: Boolean): Member?
suspend fun Guild.retrieveMemberByIdOrNull(userId: String, useCache: Boolean): Member?

Retrieves a Member with the provided ID.

Link copied to clipboard
suspend fun Guild.retrieveMemberOrNull(user: UserSnowflake, useCache: Boolean): Member?

Retrieves a Member with the provided User.

Link copied to clipboard

Retrieves a sticker from the provided ID, see JDA.retrieveSticker for more details.

Link copied to clipboard
Link copied to clipboard

Retrieves a thread by ID.

Link copied to clipboard
suspend fun JDA.retrieveUserByIdOrNull(userId: Long, useCache: Boolean): User?
suspend fun JDA.retrieveUserByIdOrNull(userId: String, useCache: Boolean): User?

Retrieves a User with the provided ID.

Link copied to clipboard

Retrieves the Vanity Invite meta-data for this guild, or null if the vanity code is null or when a INVITE_CODE_INVALID error response was caught.

Link copied to clipboard
suspend fun JDA.retrieveWebhookByIdOrNull(webhookId: Long): Webhook?
suspend fun JDA.retrieveWebhookByIdOrNull(webhookId: String): Webhook?

Retrieves a Webhook from the provided ID, see JDA.retrieveWebhookById for more details.

Link copied to clipboard
inline fun <R> runCatchingResponse(ignored: ErrorResponse, vararg ignoredResponses: ErrorResponse, block: () -> R): RestResult<R>

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(ignored: ErrorResponse, 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(ignored: ErrorResponse, 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