Package-level declarations

Types

Link copied to clipboard
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

Converts this JEmoji Emoji into a JDA UnicodeEmoji.

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 <A : Annotation> findAllAnnotations(element: KAnnotatedElement, annotationType: Class<A>, rootOverride: Boolean = true): List<A>

Finds all annotations of type A from the annotated element.

Link copied to clipboard
inline fun <A : Annotation> KAnnotatedElement.findAllAnnotations(rootOverride: Boolean = true): List<A>
fun <A : Annotation> KAnnotatedElement.findAllAnnotations(annotationType: KClass<A>, rootOverride: Boolean = true): List<A>

Finds all annotations of type A from the annotated element.

Link copied to clipboard

Finds all annotations meta-annotated with A from the annotated element.

Link copied to clipboard

Finds all annotations meta-annotated with A from the annotated element.

Link copied to clipboard
fun <A : Annotation> findAnnotationRecursive(element: KAnnotatedElement, annotationType: Class<A>): A?

Finds a single annotation of type A from the annotated element.

Link copied to clipboard

Finds a single annotation of type A from the annotated element.

Link copied to clipboard
inline fun <T, R> Iterable<T>.flatMap(transform: (T) -> Array<R>): List<R>
Link copied to clipboard
inline fun <T, R, C : MutableCollection<in R>> Iterable<T>.flatMapTo(destination: C, transform: (T) -> Array<R>): C
Link copied to clipboard

Finds all annotations from the annotated element.

Link copied to clipboard
@JvmName(name = "getAllAnnotationsKotlin")
fun KAnnotatedElement.getAllAnnotations(): List<Annotation>

Finds all annotations from the annotated element.

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 hasAnnotationRecursive(element: KAnnotatedElement, annotationType: Class<out Annotation>): Boolean

Returns true if this element is annotated with annotationType.

Link copied to clipboard

Returns true if this element is annotated with A.

Returns true if this element is annotated with annotationType.

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
fun lazyUnicodeEmoji(supplier: () -> Emoji): Lazy<UnicodeEmoji>

Lazily converts the supplied Emoji into a JDA UnicodeEmoji.

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

Configures refill that does refill of tokens in greedy manner, it will try to add the tokens to bucket as soon as possible.

Link copied to clipboard

Configures refill that does refill of tokens in intervally manner.

Link copied to clipboard

Configures refill that does refill of tokens in intervally manner. "Intervally" in opposite to "greedy" will wait until whole period will be elapsed before regenerate tokens.

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 = true): Member?
suspend fun Guild.retrieveMemberByIdOrNull(userId: String, useCache: Boolean = true): Member?

Retrieves a Member with the provided ID.

Link copied to clipboard
suspend fun Guild.retrieveMemberOrNull(userId: Long): Member?

suspend fun Guild.retrieveMemberOrNull(user: UserSnowflake, useCache: Boolean = true): 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 = true): User?
suspend fun JDA.retrieveUserByIdOrNull(userId: String, useCache: Boolean = true): User?

Retrieves a User with the provided ID.

Link copied to clipboard
suspend fun JDA.retrieveUserOrNull(userId: Long, useCache: Boolean = true): User?
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 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
inline fun <T : Any> typeReferenceOf(): TypeReference<T>

Creates a TypeReference of type 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.