Package dev.kord.core.supplier

Types

CacheEntitySupplier
Link copied to clipboard
class CacheEntitySupplier(kord: Kord) : EntitySupplier

EntitySupplier that uses a DataCache to resolve entities.

EntitySupplier
Link copied to clipboard
interface EntitySupplier

An abstraction that allows for requesting Discord entities.

EntitySupplyStrategy
Link copied to clipboard
interface EntitySupplyStrategy<T : EntitySupplier>

A supplier that accepts a Kord instance and returns an EntitySupplier of type T.

RestEntitySupplier
Link copied to clipboard
class RestEntitySupplier(kord: Kord) : EntitySupplier

EntitySupplier that uses a RestClient to resolve entities.

StoreEntitySupplier
Link copied to clipboard
class StoreEntitySupplier(supplier: EntitySupplier, cache: DataCache) : EntitySupplier

EntitySupplier that delegates to another EntitySupplier to resolve entities.

Functions

getChannelOf
Link copied to clipboard
inline suspend fun <T : Channel> EntitySupplier.getChannelOf(id: Snowflake): T

Requests the Channel with the given id as type T.

getChannelOfOrNull
Link copied to clipboard
inline suspend fun <T : Channel> EntitySupplier.getChannelOfOrNull(id: Snowflake): T?

Requests the Channel with the given id as type T, returns null if the channel isn't present or if the channel is not of type T.

getGlobalApplicationCommandOf
Link copied to clipboard
inline suspend fun <T : GlobalApplicationCommand> EntitySupplier.getGlobalApplicationCommandOf(applicationId: Snowflake, id: Snowflake): T

Requests the GlobalApplicationCommand with the given id as type T.

getGlobalApplicationCommandOfOrNull
Link copied to clipboard
inline suspend fun <T : GlobalApplicationCommand> EntitySupplier.getGlobalApplicationCommandOfOrNull(applicationId: Snowflake, id: Snowflake): T?

Requests the GuildApplicationCommand with the given id as type T, returns null if the command application isn't present or if the channel is not of type T.

getGlobalApplicationOf
Link copied to clipboard
inline suspend fun <T : GlobalApplicationCommand> EntitySupplier.getGlobalApplicationOf(applicationId: Snowflake, id: Snowflake): T

Requests the GlobalApplicationCommand with the given id as type T.

getGlobalApplicationOfOrNull
Link copied to clipboard
inline suspend fun <T : GlobalApplicationCommand> EntitySupplier.getGlobalApplicationOfOrNull(applicationId: Snowflake, id: Snowflake): T?

Requests the GlobalApplicationCommand with the given id as type T, returns null if the command application isn't present or if the channel is not of type T.

getGuildApplicationCommandOf
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> EntitySupplier.getGuildApplicationCommandOf(applicationId: Snowflake, guildId: Snowflake, id: Snowflake): T

Requests the GuildApplicationCommand with the given id as type T.

getGuildApplicationCommandOfOrNull
Link copied to clipboard
inline suspend fun <T : GuildApplicationCommand> EntitySupplier.getGuildApplicationCommandOfOrNull(applicationId: Snowflake, guildId: Snowflake, id: Snowflake): T?

Requests the GuildApplicationCommand with the given id as type T, returns null if the command application isn't present or if the channel is not of type T.

withFallback
Link copied to clipboard
infix fun EntitySupplier.withFallback(other: EntitySupplier): EntitySupplier

Creates supplier providing a strategy which will first operate on this supplier. When an entity is not present from the first supplier it will be fetched from other instead. Operations that return flows will only fall back to other when the returned flow contained no elements.