EntitySupplier

An abstraction that allows for requesting Discord entities.

See also

Inheritors

Properties

Link copied to clipboard
abstract val guilds: Flow<Guild>

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

Link copied to clipboard
abstract val regions: Flow<Region>

Requests all regions known to this bot.

Functions

Link copied to clipboard
abstract 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
abstract suspend fun getApplicationCommandPermissionsOrNull(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): ApplicationCommandPermissions?
Link copied to clipboard
open suspend fun getAutoModerationRule(guildId: Snowflake, ruleId: Snowflake): AutoModerationRule

Requests an AutoModerationRule by its id.

Link copied to clipboard
abstract suspend 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
abstract suspend fun getChannelOrNull(id: Snowflake): Channel?

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

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

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

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

Requests the webhooks of the MessageChannel with the given channelId.

Link copied to clipboard
abstract fun getCurrentUserGuilds(limit: Int? = null): 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
abstract suspend 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
abstract fun getEmojis(guildId: Snowflake): Flow<GuildEmoji>

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

Link copied to clipboard
abstract 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
abstract suspend 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
abstract suspend fun getGlobalApplicationCommandOrNull(applicationId: Snowflake, commandId: Snowflake): GlobalApplicationCommand?
Link copied to clipboard
abstract fun getGlobalApplicationCommands(applicationId: Snowflake, withLocalizations: Boolean? = null): 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
abstract suspend fun getGuildApplicationCommandOrNull(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand?
Link copied to clipboard
abstract fun getGuildApplicationCommands(applicationId: Snowflake, guildId: Snowflake, withLocalizations: Boolean? = null): 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
abstract suspend 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
abstract fun getGuildBans(guildId: Snowflake, limit: Int? = null): Flow<Ban>

Requests the bans of the Guild with the given guildId.

Link copied to clipboard

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
abstract fun getGuildMembers(guildId: Snowflake, limit: Int? = null): Flow<Member>

Requests the members of the Guild with the given guildId.

Link copied to clipboard
abstract suspend 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
abstract suspend 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
abstract 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
abstract fun getGuildScheduledEventMembersAfter(guildId: Snowflake, eventId: Snowflake, after: Snowflake, limit: Int? = null): Flow<Member>
Link copied to clipboard
abstract fun getGuildScheduledEventMembersBefore(guildId: Snowflake, eventId: Snowflake, before: Snowflake, limit: Int? = null): Flow<Member>
Link copied to clipboard
abstract suspend 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
abstract fun getGuildScheduledEventUsersAfter(guildId: Snowflake, eventId: Snowflake, after: Snowflake, limit: Int? = null): Flow<User>
Link copied to clipboard
abstract fun getGuildScheduledEventUsersBefore(guildId: Snowflake, eventId: Snowflake, before: Snowflake, limit: Int? = null): Flow<User>
Link copied to clipboard
open suspend fun getGuildSticker(guildId: Snowflake, id: Snowflake): GuildSticker
Link copied to clipboard
abstract suspend fun getGuildStickerOrNull(guildId: Snowflake, id: Snowflake): GuildSticker?
Link copied to clipboard
abstract fun getGuildStickers(guildId: Snowflake): Flow<GuildSticker>
Link copied to clipboard
abstract fun getGuildVoiceRegions(guildId: Snowflake): Flow<Region>

Requests the regions of the Guild with the given guildId.

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

Requests the webhooks of the Guild with the given guildId.

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
abstract suspend 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
abstract fun getJoinedPrivateArchivedThreads(channelId: Snowflake, before: Snowflake? = null, limit: Int? = null): 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
abstract suspend 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
abstract suspend 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
abstract fun getMessagesAfter(messageId: Snowflake, channelId: Snowflake, limit: Int? = null): Flow<Message>

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

Link copied to clipboard
abstract fun getMessagesAround(messageId: Snowflake, channelId: Snowflake, limit: Int = 100): Flow<Message>

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

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

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

Link copied to clipboard
Link copied to clipboard
abstract fun getPrivateArchivedThreads(channelId: Snowflake, before: Instant? = null, limit: Int? = null): Flow<ThreadChannel>
Link copied to clipboard
abstract fun getPublicArchivedThreads(channelId: Snowflake, before: Instant? = null, limit: Int? = null): Flow<ThreadChannel>
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
abstract suspend 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
abstract suspend 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
abstract suspend fun getStageInstanceOrNull(channelId: Snowflake): StageInstance?
Link copied to clipboard
open suspend fun getSticker(id: Snowflake): Sticker
Link copied to clipboard
abstract suspend 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
abstract suspend 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
abstract suspend fun getTemplateOrNull(code: String): Template?

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

Link copied to clipboard
abstract fun getTemplates(guildId: Snowflake): Flow<Template>
Link copied to clipboard
abstract 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
abstract suspend 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
abstract suspend fun getWebhookMessageOrNull(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, returns null when the message isn't present.

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

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.