RestEntitySupplier

EntitySupplier that uses a RestClient to resolve entities.

Error codes besides 429(Too Many Requests) will throw a RestRequestException, 404(Not Found) will be caught by the xOrNull variant and return null instead.

This supplier will always be able to resolve entities if they exist according to Discord, entities will always be up-to-date at the moment of the call.

Constructors

Link copied to clipboard
constructor(kord: Kord)

Properties

Link copied to clipboard
open override val guilds: Flow<Guild>

Requests all guilds this bot is known to be part of.

Link copied to clipboard
val kord: Kord
Link copied to clipboard
open override val regions: Flow<Region>

Requests all regions known to this bot.

Functions

Link copied to clipboard
open override fun getActiveThreads(guildId: Snowflake): Flow<ThreadChannel>
Link copied to clipboard
open suspend fun getApplicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): ApplicationCommandPermissions
Link copied to clipboard
open suspend override fun getApplicationCommandPermissionsOrNull(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): ApplicationCommandPermissions
Link copied to clipboard

Requests to get the information of the current application.

Link copied to clipboard
Link copied to clipboard
open suspend fun getAutoModerationRule(guildId: Snowflake, ruleId: Snowflake): AutoModerationRule

Requests an AutoModerationRule by its id.

Link copied to clipboard
open suspend override fun getAutoModerationRuleOrNull(guildId: Snowflake, ruleId: Snowflake): AutoModerationRule?

Requests an AutoModerationRule by its id. Returns null if it wasn't found.

Link copied to clipboard

Requests to get all AutoModerationRules currently configured for the Guild with the given guildId.

Link copied to clipboard
open suspend fun getChannel(id: Snowflake): Channel

Requests the Channel with the given id.

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

Requests the Channel with the given id as type T.

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.

Link copied to clipboard
open suspend override fun getChannelOrNull(id: Snowflake): Channel?

Requests the Channel with the given id, returns null when the channel isn't present.

Link copied to clipboard
open override fun getChannelPins(channelId: Snowflake): Flow<Message>

Requests the pinned messages of the Channel with the given channelId.

Link copied to clipboard
open override fun getChannelWebhooks(channelId: Snowflake): Flow<Webhook>

Requests the webhooks of the MessageChannel with the given channelId.

Link copied to clipboard
open override fun getCurrentUserGuilds(limit: Int?): Flow<Guild>

Requests guilds this bot is known to be part of.

Link copied to clipboard
open suspend fun getEmoji(guildId: Snowflake, emojiId: Snowflake): GuildEmoji

Requests the GuildEmoji with the emojiId in the Guild wit the given guildId.

Link copied to clipboard
open suspend override fun getEmojiOrNull(guildId: Snowflake, emojiId: Snowflake): GuildEmoji?

Requests the GuildEmoji with the emojiId in the Guild wit the given guildId, returns null when the emoji isn't present.

Link copied to clipboard
open override fun getEmojis(guildId: Snowflake): Flow<GuildEmoji>

Requests the guild emojis of the Guild with the given guildId.

Link copied to clipboard
open override fun getEntitlements(applicationId: Snowflake, request: EntitlementsListRequest): Flow<Entitlement>

Requests to get all Entitlements for the Application with the given applicationId.

Link copied to clipboard
open suspend fun getFollowupMessage(applicationId: Snowflake, interactionToken: String, messageId: Snowflake): FollowupMessage

Requests a followup message for an interaction response.

Link copied to clipboard
open suspend override fun getFollowupMessageOrNull(applicationId: Snowflake, interactionToken: String, messageId: Snowflake): FollowupMessage?

Requests a followup message for an interaction response. Returns null if the followup message isn't present.

Link copied to clipboard
open suspend fun getGlobalApplicationCommand(applicationId: Snowflake, commandId: Snowflake): GlobalApplicationCommand
Link copied to clipboard

Requests the GlobalApplicationCommand with the given id as type T.

Link copied to clipboard

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.

Link copied to clipboard
open suspend override fun getGlobalApplicationCommandOrNull(applicationId: Snowflake, commandId: Snowflake): GlobalApplicationCommand?
Link copied to clipboard
open override fun getGlobalApplicationCommands(applicationId: Snowflake, withLocalizations: Boolean?): Flow<GlobalApplicationCommand>
Link copied to clipboard

Requests the GlobalApplicationCommand with the given id as type T.

Link copied to clipboard

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.

Link copied to clipboard
open suspend fun getGuild(id: Snowflake): Guild

Requests the Guild with the given id.

Link copied to clipboard
open suspend fun getGuildApplicationCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand
Link copied to clipboard

Requests the GuildApplicationCommand with the given id as type T.

Link copied to clipboard

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.

Link copied to clipboard
open suspend override fun getGuildApplicationCommandOrNull(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand?
Link copied to clipboard
open override fun getGuildApplicationCommands(applicationId: Snowflake, guildId: Snowflake, withLocalizations: Boolean?): Flow<GuildApplicationCommand>
Link copied to clipboard
open suspend fun getGuildBan(guildId: Snowflake, userId: Snowflake): Ban

Requests the Ban for the user the given userId in the Guild wit the given guildId, returns null when the ban isn't present.

Link copied to clipboard
open suspend override fun getGuildBanOrNull(guildId: Snowflake, userId: Snowflake): Ban?

Requests the Ban for the user the given userId in the Guild wit the given guildId, returns null when the ban isn't present.

Link copied to clipboard
open override fun getGuildBans(guildId: Snowflake, limit: Int?): Flow<Ban>

Requests the bans of the Guild with the given guildId.

Link copied to clipboard
open override fun getGuildChannels(guildId: Snowflake): Flow<TopGuildChannel>

Requests the channels of the Guild with the given guildId, channels with an Unknown type will be filtered out of the list.

Link copied to clipboard
open override fun getGuildMembers(guildId: Snowflake, limit: Int?): Flow<Member>

Requests the members of the Guild with the given guildId.

Link copied to clipboard

Requests the onboarding object for the Guild with the given guildId.

Link copied to clipboard

Requests the onboarding object for the Guild with the given guildId. Returns null if it wasn't found.

Link copied to clipboard
open suspend override fun getGuildOrNull(id: Snowflake): Guild?

Requests the Guild with the given id, returns null when the guild isn't present.

Link copied to clipboard
open suspend fun getGuildPreview(guildId: Snowflake): GuildPreview

Requests the preview of the guild matching the guildId. If the bot is not in the guild, then the guild must be lurkable.

Link copied to clipboard
open suspend override fun getGuildPreviewOrNull(guildId: Snowflake): GuildPreview?

Requests the preview of the guild matching the guildId. If the bot is not in the guild, then the guild must be lurkable. Returns null if the preview was not found.

Link copied to clipboard
open override fun getGuildRoles(guildId: Snowflake): Flow<Role>

Requests the roles of the Guild with the given guildId.

Link copied to clipboard
open suspend fun getGuildScheduledEvent(guildId: Snowflake, eventId: Snowflake): GuildScheduledEvent
Link copied to clipboard
open fun getGuildScheduledEventMembers(guildId: Snowflake, eventId: Snowflake, limit: Int? = null): Flow<Member>
Link copied to clipboard
open override fun getGuildScheduledEventMembersAfter(guildId: Snowflake, eventId: Snowflake, after: Snowflake, limit: Int?): Flow<Member>
Link copied to clipboard
open override fun getGuildScheduledEventMembersBefore(guildId: Snowflake, eventId: Snowflake, before: Snowflake, limit: Int?): Flow<Member>
Link copied to clipboard
open suspend override fun getGuildScheduledEventOrNull(guildId: Snowflake, eventId: Snowflake): GuildScheduledEvent?
Link copied to clipboard
Link copied to clipboard
open fun getGuildScheduledEventUsers(guildId: Snowflake, eventId: Snowflake, limit: Int? = null): Flow<User>
Link copied to clipboard
open override fun getGuildScheduledEventUsersAfter(guildId: Snowflake, eventId: Snowflake, after: Snowflake, limit: Int?): Flow<User>
Link copied to clipboard
open override fun getGuildScheduledEventUsersBefore(guildId: Snowflake, eventId: Snowflake, before: Snowflake, limit: Int?): Flow<User>
Link copied to clipboard
open suspend fun getGuildSticker(guildId: Snowflake, id: Snowflake): GuildSticker
Link copied to clipboard
open suspend override fun getGuildStickerOrNull(guildId: Snowflake, id: Snowflake): GuildSticker?
Link copied to clipboard
open override fun getGuildStickers(guildId: Snowflake): Flow<GuildSticker>
Link copied to clipboard
open override fun getGuildVoiceRegions(guildId: Snowflake): Flow<Region>

Requests the regions of the Guild with the given guildId.

Link copied to clipboard
open override fun getGuildWebhooks(guildId: Snowflake): Flow<Webhook>

Requests the webhooks of the Guild with the given guildId.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open suspend fun getGuildWidget(guildId: Snowflake): GuildWidget

Requests to get the widget of a Guild with the given id.

Link copied to clipboard
open suspend override fun getGuildWidgetOrNull(guildId: Snowflake): GuildWidget?

Requests to get the widget of a Guild with the given id, returns null if the GuildWidget isn't present.

Link copied to clipboard
suspend fun getInvite(code: String, withCounts: Boolean = true, withExpiration: Boolean = true, scheduledEventId: Snowflake? = null): Invite
Link copied to clipboard
suspend fun getInviteOrNull(code: String, withCounts: Boolean = true, withExpiration: Boolean = true, scheduledEventId: Snowflake? = null): Invite?
Link copied to clipboard
open override fun getJoinedPrivateArchivedThreads(channelId: Snowflake, before: Snowflake?, limit: Int?): Flow<ThreadChannel>
Link copied to clipboard
open suspend fun getMember(guildId: Snowflake, userId: Snowflake): Member

Requests the Member with the given userId in the Guild wit the given guildId.

Link copied to clipboard
open suspend override fun getMemberOrNull(guildId: Snowflake, userId: Snowflake): Member?

Requests the Member with the given userId in the Guild wit the given guildId, returns null when the member isn't present.

Link copied to clipboard
open suspend fun getMessage(channelId: Snowflake, messageId: Snowflake): Message

Requests the Message with the given messageId in the MessageChannel with the given channelId.

Link copied to clipboard
open suspend override fun getMessageOrNull(channelId: Snowflake, messageId: Snowflake): Message?

Requests the Message with the given messageId in the MessageChannel with the given channelId, returns null when the message isn't present.

Link copied to clipboard
open override fun getMessagesAfter(messageId: Snowflake, channelId: Snowflake, limit: Int?): Flow<Message>

Requests a flow of messages created after the Message with the messageId in the MessageChannel with the channelId.

Link copied to clipboard
open override fun getMessagesAround(messageId: Snowflake, channelId: Snowflake, limit: Int): Flow<Message>

Requests a flow of messages created around the Message with the messageId in the MessageChannel with the channelId.

Link copied to clipboard
open override fun getMessagesBefore(messageId: Snowflake, channelId: Snowflake, limit: Int?): Flow<Message>

Requests a flow of messages created before the Message with the messageId in the MessageChannel with the channelId.

Link copied to clipboard
open override fun getNitroStickerPacks(): Flow<StickerPack>
Link copied to clipboard
suspend fun getOriginalInteraction(applicationId: Snowflake, token: String): Message

Requests the initial interaction response.

Link copied to clipboard
suspend fun getOriginalInteractionOrNull(applicationId: Snowflake, token: String): Message?

Requests the initial interaction response, returns null if the initial interaction response isn't present.

Link copied to clipboard
open override fun getPrivateArchivedThreads(channelId: Snowflake, before: Instant?, limit: Int?): Flow<ThreadChannel>
Link copied to clipboard
open override fun getPublicArchivedThreads(channelId: Snowflake, before: Instant?, limit: Int?): Flow<ThreadChannel>
Link copied to clipboard
fun getReactors(channelId: Snowflake, messageId: Snowflake, emoji: ReactionEmoji): Flow<User>
Link copied to clipboard
open suspend fun getRole(guildId: Snowflake, roleId: Snowflake): Role

Requests the Role with the given roleId in the Guild wit the given guildId.

Link copied to clipboard
open suspend override fun getRoleOrNull(guildId: Snowflake, roleId: Snowflake): Role?

Requests the Role with the given roleId in the Guild wit the given guildId, returns null when the role isn't present.

Link copied to clipboard
open suspend fun getSelf(): User

Requests the User this bot represents.

Link copied to clipboard
open suspend override fun getSelfOrNull(): User?

Requests the User this bot represents, returns null when the user isn't present.

Link copied to clipboard
open suspend fun getStageInstance(channelId: Snowflake): StageInstance
Link copied to clipboard
open suspend override fun getStageInstanceOrNull(channelId: Snowflake): StageInstance?
Link copied to clipboard
open suspend fun getSticker(id: Snowflake): Sticker
Link copied to clipboard
open suspend override fun getStickerOrNull(id: Snowflake): Sticker?
Link copied to clipboard
open suspend fun getSubscription(skuId: Snowflake, subscriptionId: Snowflake): Subscription

Requests a Subscription by its id.

Link copied to clipboard
open suspend override fun getSubscriptionOrNull(skuId: Snowflake, subscriptionId: Snowflake): Subscription?

Requests a Subscription by its id. Returns null if it wasn't found.

Link copied to clipboard

Requests to get all Subscriptions containing the Sku with the given skuId.

Link copied to clipboard
open suspend fun getTemplate(code: String): Template

Requests the Template with the given code. returns null when the webhook isn't present.

Link copied to clipboard
open suspend override fun getTemplateOrNull(code: String): Template?

Requests the Template with the given code. returns null when the template isn't present.

Link copied to clipboard
open override fun getTemplates(guildId: Snowflake): Flow<Template>
Link copied to clipboard
open override fun getThreadMembers(channelId: Snowflake): Flow<ThreadMember>
Link copied to clipboard
open suspend fun getUser(id: Snowflake): User

Requests the User with the given id.

Link copied to clipboard
open suspend override fun getUserOrNull(id: Snowflake): User?

Requests the User with the given id, returns null when the user isn't present.

Link copied to clipboard
open suspend fun getWebhook(id: Snowflake): Webhook

Requests the Webhook with the given id.

Link copied to clipboard
open suspend fun getWebhookMessage(webhookId: Snowflake, token: String, messageId: Snowflake, threadId: Snowflake? = null): Message

Requests the Message with the given messageId previously sent from a Webhook with the given webhookId using the token for authentication.

Link copied to clipboard
open suspend override fun getWebhookMessageOrNull(webhookId: Snowflake, token: String, messageId: Snowflake, threadId: Snowflake?): Message?

Requests the Message with the given messageId previously sent from a Webhook with the given webhookId using the token for authentication, returns null when the message isn't present.

Link copied to clipboard
open suspend override fun getWebhookOrNull(id: Snowflake): Webhook?

Requests the Webhook with the given id, returns null when the webhook isn't present.

Link copied to clipboard
open suspend fun getWebhookWithToken(id: Snowflake, token: String): Webhook

Requests the Webhook with the given id using the token for authentication.

Link copied to clipboard
open suspend override fun getWebhookWithTokenOrNull(id: Snowflake, token: String): Webhook?

Requests the Webhook with the given id using the token for authentication, returns null when the webhook isn't present.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

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.