diff --git a/core/src/commonMain/kotlin/ClientResources.kt b/core/src/commonMain/kotlin/ClientResources.kt index 5c2a1c2c8c1c..5964dd1fb68c 100644 --- a/core/src/commonMain/kotlin/ClientResources.kt +++ b/core/src/commonMain/kotlin/ClientResources.kt @@ -5,6 +5,16 @@ import dev.kord.core.supplier.EntitySupplyStrategy import dev.kord.gateway.builder.Shards import io.ktor.client.* +/** + * The resources for the Kord Instance. + * + * @param token The Bots token + * @param applicationId The ID of the application + * @param shards The [Shards] for the application + * @param maxConcurrency The maximum concurrency for the bot. Can be obtained by calling the `Route.GatewayBotGet` endpoint. + * @param httpClient The [HttpClient] the client is connected through + * @param defaultStrategy The default [EntitySupplyStrategy] for the client. + */ public class ClientResources( public val token: String, public val applicationId: Snowflake, diff --git a/core/src/commonMain/kotlin/Kord.kt b/core/src/commonMain/kotlin/Kord.kt index f116b1b2571e..bc4634bd3135 100644 --- a/core/src/commonMain/kotlin/Kord.kt +++ b/core/src/commonMain/kotlin/Kord.kt @@ -62,13 +62,16 @@ public class Kord( private val interceptor: GatewayEventInterceptor, ) : CoroutineScope { + /** + * Returns a [Flow] of Nitro [StickerPack]s + */ public val nitroStickerPacks: Flow get() = defaultSupplier.getNitroStickerPacks() /** * The default supplier, obtained through Kord's [resources] and configured through [KordBuilder.defaultStrategy]. - * By default a strategy from [EntitySupplyStrategy.rest]. + * By default, a strategy from [EntitySupplyStrategy.rest]. * * All [strategizable][Strategizable] [entities][KordEntity] created through this instance will use this supplier by default. */ @@ -99,9 +102,15 @@ public class Kord( override val coroutineContext: CoroutineContext = SupervisorJob() + dispatcher + /** + * Returns a [Flow] of [Region]s know to the bot. + */ public val regions: Flow get() = defaultSupplier.regions + /** + * Returns a [Flow] of [Guild]s know to the bot. + */ public val guilds: Flow get() = defaultSupplier.guilds @@ -148,6 +157,12 @@ public class Kord( public fun with(strategy: EntitySupplyStrategy): T = strategy.supply(this) + /** + * Requests to get the information of the current application using the [EntitySupplyStrategy.rest] supplier. + * + * Entities will be fetched from Discord directly, ignoring any cached values. + * @throws RestRequestException when the request failed. + */ public suspend fun getApplicationInfo(): Application = with(EntitySupplyStrategy.rest).getApplicationInfo() /** @@ -366,6 +381,11 @@ public class Kord( ): Invite? = with(EntitySupplyStrategy.rest).getInviteOrNull(code, withCounts, withExpiration, scheduledEventId) + /** + * Gets a [Sticker] from its [id]. + * + * @return [EntityNotFoundException.stickerNotFound] if the sticker is not found + */ public suspend fun getSticker(id: Snowflake): Sticker = defaultSupplier.getSticker(id) @@ -426,11 +446,23 @@ public class Kord( } } - + /** + * Gets the [GlobalApplicationCommand]s for this bot. + * + * @param withLocalizations Whether to get the commands with localisations or not. Defaults to `null` + * @return a [Flow] of [GlobalApplicationCommand]s for this bot. + */ public fun getGlobalApplicationCommands(withLocalizations: Boolean? = null): Flow { return defaultSupplier.getGlobalApplicationCommands(resources.applicationId, withLocalizations) } + /** + * Gets the [GuildApplicationCommand]s for a given [guildId]. + * + * @param guildId The ID of the guild to get the commands for + * @param withLocalizations Whether to get the commands with localizations or not. Defaults to `null` + * @return a [Flow] of [GuildApplicationCommand]s for the given [guildId]. + */ public fun getGuildApplicationCommands( guildId: Snowflake, withLocalizations: Boolean? = null, @@ -438,11 +470,24 @@ public class Kord( return defaultSupplier.getGuildApplicationCommands(resources.applicationId, guildId, withLocalizations) } + /** + * Gets a [GuildApplicationCommand] based on the [guildId] and [commandId]. + * + * @param guildId The ID of the guild to get the command for + * @param commandId The ID of the command to get + * @return The [GuildApplicationCommand] or [EntityNotFoundException.applicationCommandNotFound] if it was not found. + */ public suspend fun getGuildApplicationCommand(guildId: Snowflake, commandId: Snowflake): GuildApplicationCommand { return defaultSupplier.getGuildApplicationCommand(resources.applicationId, guildId, commandId) } - + /** + * Gets a [GuildApplicationCommand] based on the [guildId] and [commandId]. + * + * @param guildId The ID of the guild to get the command from + * @param commandId The ID of the command to get + * @return The [GuildApplicationCommand] or `null` if it was not found. + */ public suspend fun getGuildApplicationCommandOrNull( guildId: Snowflake, commandId: Snowflake @@ -450,7 +495,13 @@ public class Kord( return defaultSupplier.getGuildApplicationCommandOrNull(resources.applicationId, guildId, commandId) } - + /** + * Gets a Guild application command of type [T], based on the [guildId] and [commandId] + * + * @param guildId The ID the guild to get the command from + * @param commandId The ID of the command to get + * @return The command of type [T] or [EntityNotFoundException.applicationCommandNotFound] if it was not found. + */ public suspend inline fun getGuildApplicationCommandOf( guildId: Snowflake, commandId: Snowflake @@ -458,7 +509,13 @@ public class Kord( return defaultSupplier.getGuildApplicationCommandOf(resources.applicationId, guildId, commandId) } - + /** + * Gets a Guild application command of type [T], based on the [guildId] and [commandId] + * + * @param guildId The ID the guild to get the command from + * @param commandId The ID of the command to get + * @return The command of type [T] or `null` if it was not found. + */ public suspend inline fun getGuildApplicationCommandOfOrNull( guildId: Snowflake, commandId: Snowflake @@ -466,27 +523,55 @@ public class Kord( return defaultSupplier.getGuildApplicationCommandOfOrNull(resources.applicationId, guildId, commandId) } - + /** + * Gets a [GlobalApplicationCommand] based off the [commandId]. + * + * @param commandId The ID of the command to get. + * @return The [GlobalApplicationCommand] or [EntityNotFoundException.applicationCommandNotFound] if it was not found. + */ public suspend fun getGlobalApplicationCommand(commandId: Snowflake): GlobalApplicationCommand { return defaultSupplier.getGlobalApplicationCommand(resources.applicationId, commandId) } - + /** + * Gets a [GlobalApplicationCommand] based off the [commandId]. + * + * @param commandId The ID of the command to get. + * @return The [GlobalApplicationCommand] or `null` if it was not found. + */ public suspend fun getGlobalApplicationCommandOrNull(commandId: Snowflake): GlobalApplicationCommand? { return defaultSupplier.getGlobalApplicationCommandOrNull(resources.applicationId, commandId) } - + /** + * Gets a Global application command of type [T] based off the [commandId]. + * + * @param commandId The ID of the command to get. + * @return The application command of type [T] or [EntityNotFoundException.applicationCommandNotFound] if it was not found. + */ public suspend fun getGlobalApplicationCommandOf(commandId: Snowflake): T { return defaultSupplier.getGlobalApplicationCommandOf(resources.applicationId, commandId) } - + /** + * Gets a Global application command of type [T] based off the [commandId]. + * + * @param commandId The ID of the command to get. + * @return The application command of type [T] or `null` if it was not found. + */ public suspend fun getGlobalApplicationCommandOfOrNull(commandId: Snowflake): T? { return defaultSupplier.getGlobalApplicationCommandOfOrNull(resources.applicationId, commandId) } + /** + * Creates a [GlobalChatInputCommand] for this bot. + * + * @param name The command name + * @param description The command description + * @param builder A [GlobalChatInputCreateBuilder] to modify the command. + * @return The [GlobalChatInputCommand] for the bot. + */ public suspend inline fun createGlobalChatInputCommand( name: String, description: String, @@ -503,6 +588,13 @@ public class Kord( return GlobalChatInputCommand(data, rest.interaction) } + /** + * Creates a [GlobalMessageCommand] for this bot. + * + * @param name The command name + * @param builder A [GlobalMessageCommandCreateBuilder] to modify the command. + * @return The [GlobalMessageCommand] for the bot. + */ public suspend inline fun createGlobalMessageCommand( name: String, builder: GlobalMessageCommandCreateBuilder.() -> Unit = {}, @@ -514,6 +606,13 @@ public class Kord( return GlobalMessageCommand(data, rest.interaction) } + /** + * Creates a [GlobalUserCommand] for this bot. + * + * @param name The command name + * @param builder A [GlobalUserCommandCreateBuilder] to modify the command. + * @return The [GlobalUserCommand] for the bot. + */ public suspend inline fun createGlobalUserCommand( name: String, builder: GlobalUserCommandCreateBuilder.() -> Unit = {}, @@ -525,7 +624,12 @@ public class Kord( return GlobalUserCommand(data, rest.interaction) } - + /** + * Creates multiple [GlobalApplicationCommand]s. + * + * @param builder A [GlobalMultiApplicationCommandBuilder] to create the commands in. + * @return A [Flow] of [GlobalApplicationCommand]s for the bot. + */ public suspend inline fun createGlobalApplicationCommands( builder: GlobalMultiApplicationCommandBuilder.() -> Unit, ): Flow { @@ -540,6 +644,16 @@ public class Kord( } } + /** + * Creates a [GuildChatInputCommand] for a given [guildId] + * + * @param guildId The ID of the guild to create the command + * @param name The name of the command + * @param description The description of the command + * @param builder A [ChatInputCreateBuilder] to modify the command + * + * @return a [GuildChatInputCommand] object for the command + */ public suspend inline fun createGuildChatInputCommand( guildId: Snowflake, name: String, @@ -560,6 +674,15 @@ public class Kord( } + /** + * Creates a [GuildMessageCommand] for a given [guildId] + * + * @param guildId The ID of the guild to create the command + * @param name The name of the command + * @param builder A [MessageCommandCreateBuilder] to modify the command + * + * @return a [GuildMessageCommand] object for the command + */ public suspend inline fun createGuildMessageCommand( guildId: Snowflake, name: String, @@ -576,6 +699,15 @@ public class Kord( return GuildMessageCommand(data, rest.interaction) } + /** + * Creates a [GuildUserCommand] for a given [guildId] + * + * @param guildId The ID of the guild to create the command + * @param name The name of the command + * @param builder A [UserCommandCreateBuilder] to modify the command + * + * @return a [GuildUserCommand] object for the command + */ public suspend inline fun createGuildUserCommand( guildId: Snowflake, name: String, @@ -593,7 +725,12 @@ public class Kord( return GuildUserCommand(data, rest.interaction) } - + /** + * Creates multiple [GuildApplicationCommand]s. + * + * @param builder A [GuildMultiApplicationCommandBuilder] to create the commands in. + * @return A [Flow] of [GuildApplicationCommand]s for the bot. + */ public suspend inline fun createGuildApplicationCommands( guildId: Snowflake, builder: GuildMultiApplicationCommandBuilder.() -> Unit, diff --git a/core/src/commonMain/kotlin/Unsafe.kt b/core/src/commonMain/kotlin/Unsafe.kt index 269d0676fb5c..615be4e3921a 100644 --- a/core/src/commonMain/kotlin/Unsafe.kt +++ b/core/src/commonMain/kotlin/Unsafe.kt @@ -26,94 +26,287 @@ import dev.kord.rest.service.InteractionService @KordUnsafe @KordExperimental public class Unsafe(private val kord: Kord) { - + /** + * Returns an [AutoModerationRuleBehavior] for a given [guildId]. + * + * @param guildId The ID to create the [AutoModerationRuleBehavior] for + * @param ruleId The ID of the [AutoModerationRuleBehavior] + * @return The created [AutoModerationRuleBehaviorImpl] + */ public fun autoModerationRule(guildId: Snowflake, ruleId: Snowflake): AutoModerationRuleBehavior = AutoModerationRuleBehaviorImpl(guildId, ruleId, kord) + /** + * Returns an [KeywordAutoModerationRuleBehavior] for a given [guildId]. + * + * @param guildId The ID to create the [KeywordAutoModerationRuleBehavior] for + * @param ruleId The ID of the [KeywordAutoModerationRuleBehavior] + * @return The created [KeywordAutoModerationRuleBehaviorImpl] + */ public fun keywordAutoModerationRule(guildId: Snowflake, ruleId: Snowflake): KeywordAutoModerationRuleBehavior = KeywordAutoModerationRuleBehaviorImpl(guildId, ruleId, kord) + /** + * Returns an [SpamAutoModerationRuleBehavior] for a given [guildId]. + * + * @param guildId The ID to create the [SpamAutoModerationRuleBehavior] for + * @param ruleId The ID of the [SpamAutoModerationRuleBehavior] + * @return The created [SpamAutoModerationRuleBehaviorImpl] + */ public fun spamAutoModerationRule(guildId: Snowflake, ruleId: Snowflake): SpamAutoModerationRuleBehavior = SpamAutoModerationRuleBehaviorImpl(guildId, ruleId, kord) + /** + * Returns an [KeywordPresetAutoModerationRuleBehavior] for a given [guildId]. + * + * @param guildId The ID to create the [KeywordPresetAutoModerationRuleBehavior] for + * @param ruleId The ID of the [KeywordPresetAutoModerationRuleBehavior] + * @return The created [KeywordPresetAutoModerationRuleBehaviorImpl] + */ public fun keywordPresetAutoModerationRule( guildId: Snowflake, ruleId: Snowflake, ): KeywordPresetAutoModerationRuleBehavior = KeywordPresetAutoModerationRuleBehaviorImpl(guildId, ruleId, kord) + /** + * Returns an [MentionSpamAutoModerationRuleBehavior] for a given [guildId]. + * + * @param guildId The ID to create the [MentionSpamAutoModerationRuleBehavior] for + * @param ruleId The ID of the [MentionSpamAutoModerationRuleBehavior] + * @return The created [MentionSpamAutoModerationRuleBehaviorImpl] + */ public fun mentionSpamAutoModerationRule( guildId: Snowflake, ruleId: Snowflake, ): MentionSpamAutoModerationRuleBehavior = MentionSpamAutoModerationRuleBehaviorImpl(guildId, ruleId, kord) + /** + * Returns a [MessageBehavior] for a given [messageId] + * + * @param channelId The ID of the channel the message was sent in + * @param messageId The ID of the message + * @return The [MessageBehavior] for the message + */ public fun message(channelId: Snowflake, messageId: Snowflake): MessageBehavior = MessageBehavior(channelId = channelId, messageId = messageId, kord = kord) + /** + * Returns a [ChannelBehavior] for a given [id] + * + * @param id The ID of the channel + * @return The [ChannelBehavior] for the channel + */ public fun channel(id: Snowflake): ChannelBehavior = ChannelBehavior(id, kord) + /** + * Returns a [MessageChannelBehavior] for a given [id] + * + * @param id The ID of the channel + * @return The [MessageChannelBehavior] for the channel + */ public fun messageChannel(id: Snowflake): MessageChannelBehavior = MessageChannelBehavior(id, kord) + /** + * Returns a [TopGuildChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [TopGuildChannelBehavior] for the channel + */ public fun topGuildChannel(guildId: Snowflake, id: Snowflake): TopGuildChannelBehavior = TopGuildChannelBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [CategorizableChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [CategorizableChannelBehavior] for the channel + */ public fun categorizableChannel(guildId: Snowflake, id: Snowflake): CategorizableChannelBehavior = CategorizableChannelBehavior(guildId, id, kord) + /** + * Returns a [TopGuildMessageChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [TopGuildMessageChannelBehavior] for the channel + */ public fun topGuildMessageChannel(guildId: Snowflake, id: Snowflake): TopGuildMessageChannelBehavior = TopGuildMessageChannelBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [GuildChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [GuildChannelBehavior] for the channel + */ public fun guildChannel(guildId: Snowflake, id: Snowflake): GuildChannelBehavior = GuildChannelBehavior(guildId, id, kord) + /** + * Returns a [GuildMessageChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [GuildMessageChannelBehavior] for the channel + */ public fun guildMessageChannel(guildId: Snowflake, id: Snowflake): GuildMessageChannelBehavior = GuildMessageChannelBehavior(guildId, id, kord) + /** + * Returns a [NewsChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [NewsChannelBehavior] for the channel + */ public fun newsChannel(guildId: Snowflake, id: Snowflake): NewsChannelBehavior = NewsChannelBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [TextChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [TextChannelBehavior] for the channel + */ public fun textChannel(guildId: Snowflake, id: Snowflake): TextChannelBehavior = TextChannelBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [VoiceChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the channel is in + * @param id The ID of the channel + * @return The [VoiceChannelBehavior] for the channel + */ public fun voiceChannel(guildId: Snowflake, id: Snowflake): VoiceChannelBehavior = VoiceChannelBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [ThreadParentChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the thread parent is in + * @param id The ID of the channel + * @return The [ThreadParentChannelBehavior] for the channel + */ public fun publicThreadParent(guildId: Snowflake, id: Snowflake): ThreadParentChannelBehavior = ThreadParentChannelBehavior(guildId, id, kord) + /** + * Returns a [PrivateThreadParentChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the thread parent is in + * @param id The ID of the channel + * @return The [PrivateThreadParentChannelBehavior] for the channel + */ public fun privateThreadParent(guildId: Snowflake, id: Snowflake): PrivateThreadParentChannelBehavior = PrivateThreadParentChannelBehavior(guildId, id, kord) + /** + * Returns a [ThreadChannelBehavior] for a given [id] + * + * @param guildId The ID of the guild the thread parent is in + * @param parentId The ID of the parent channel for the thread + * @param id The ID of the channel + * @return The [ThreadChannelBehavior] for the channel + */ public fun thread(guildId: Snowflake, parentId: Snowflake, id: Snowflake): ThreadChannelBehavior = ThreadChannelBehavior(guildId, parentId, id, kord) - + /** + * Returns a [GuildBehavior] for a given [id] + * + * @param id The ID of the guild + * @return The [GuildBehavior] for the ID + */ public fun guild(id: Snowflake): GuildBehavior = GuildBehavior(id, kord) + /** + * Returns a [GuildEmojiBehavior] for a given [id] + * + * @param guildId The ID of the guild the emoji is in + * @param id The ID of the emoji + * @param kord The Kord instance for the bot + * @return The [GuildEmojiBehavior] for the ID + */ public fun guildEmoji(guildId: Snowflake, id: Snowflake, kord: Kord): GuildEmojiBehavior = GuildEmojiBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [RoleBehavior] for a given [id] + * + * @param guildId The ID of the guild the role is in + * @param id The ID of the role + * @return The [RoleBehavior] for the ID + */ public fun role(guildId: Snowflake, id: Snowflake): RoleBehavior = RoleBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [UserBehavior] for a given [id] + * + * @param id The ID of the user + * @return The [UserBehavior] for the ID + */ public fun user(id: Snowflake): UserBehavior = UserBehavior(id, kord) + /** + * Returns a [ThreadMemberBehavior] for a given [id] + * + * @param id The ID of the user + * @param threadId The ID of the thread + * @return The [ThreadMemberBehavior] for the ID + */ public fun threadMember(id: Snowflake, threadId: Snowflake): ThreadMemberBehavior = ThreadMemberBehavior(id, threadId, kord) + /** + * Returns a [MemberBehavior] for a given [id] + * + * @param guildId The ID of the guild the member is in + * @param id The ID of the user + * @return The [MemberBehavior] for the ID + */ public fun member(guildId: Snowflake, id: Snowflake): MemberBehavior = MemberBehavior(guildId = guildId, id = id, kord = kord) + /** + * Returns a [WebhookBehavior] for a given [id] + * + * @param id The ID of the guild + * @return The [WebhookBehavior] for the ID + */ public fun webhook(id: Snowflake): WebhookBehavior = WebhookBehavior(id, kord) + /** + * Returns a [StageInstanceBehavior] for a given [id] + * + * @param id The ID of the stage instance + * @param channelId The ID of the channel the instance is in + * @return The [StageInstanceBehavior] for the ID + */ public fun stageInstance(id: Snowflake, channelId: Snowflake): StageInstanceBehavior = StageInstanceBehavior( id, channelId, kord, kord.defaultSupplier ) + /** + * Returns a [ApplicationCommandInteractionBehavior] for a given [id] + * + * @param id The ID of the application command + * @param channelId The ID of the channel the interaction took place in + * @param token The interactions token + * @param applicationId The ID of the application the interaction happened with + * @return The [ApplicationCommandInteractionBehavior] for the ID + */ public fun applicationCommandInteraction( id: Snowflake, channelId: Snowflake, @@ -123,7 +316,13 @@ public class Unsafe(private val kord: Kord) { return ApplicationCommandInteractionBehavior(id, channelId, token, applicationId, kord) } - + /** + * Returns a [GlobalApplicationCommandBehavior] for a given [id] + * + * @param applicationId The ID of the application the interaction happened with + * @param id The ID of the application command + * @return The [GlobalApplicationCommandBehavior] for the ID + */ public fun globalApplicationCommand( applicationId: Snowflake, id: Snowflake @@ -132,6 +331,14 @@ public class Unsafe(private val kord: Kord) { } + /** + * Returns a [GuildApplicationCommandBehavior] for a given [id] + * + * @param applicationId The ID of the application the interaction happened with + * @param guildId The ID of the guild the interaction happened in + * @param id The ID of the application command + * @return The [GuildApplicationCommandBehavior] for the ID + */ public fun globalApplicationCommand( applicationId: Snowflake, guildId: Snowflake, @@ -145,6 +352,15 @@ public class Unsafe(private val kord: Kord) { return "Unsafe" } + /** + * Returns a [GuildApplicationCommandBehavior] for a given [commandId] + * + * @param guildId The ID of the guild the interaction happened in + * @param applicationId The ID of the application the interaction happened with + * @param commandId The ID of the application command + * @param service The interaction service for the command + * @return The [GuildApplicationCommandBehavior] for the ID + */ public fun guildApplicationCommand( guildId: Snowflake, applicationId: Snowflake, @@ -153,6 +369,14 @@ public class Unsafe(private val kord: Kord) { ): GuildApplicationCommandBehavior = GuildApplicationCommandBehavior(guildId, applicationId, commandId, service) + /** + * Returns a [GlobalApplicationCommandBehavior] for a given [commandId] + * + * @param applicationId The ID of the application the interaction happened with + * @param commandId The ID of the application command + * @param service The interaction service for the command + * @return The [GlobalApplicationCommandBehavior] for the ID + */ public fun globalApplicationCommand( applicationId: Snowflake, commandId: Snowflake, @@ -173,6 +397,13 @@ public class Unsafe(private val kord: Kord) { id, channelId, token, applicationId, kord ) + /** + * Returns a [GuildScheduledEventBehavior] for a given [id] + * + * @param id The ID of the event + * @param guildId The ID of the event the guild is for + * @return The [GuildScheduledEventBehavior] for the ID + */ public fun guildScheduledEvent(id: Snowflake, guildId: Snowflake): GuildScheduledEventBehavior = GuildScheduledEventBehavior( id, diff --git a/core/src/commonMain/kotlin/behavior/ChatInputCommandBehavior.kt b/core/src/commonMain/kotlin/behavior/ChatInputCommandBehavior.kt index 8cb456a69835..986ae7b1ed08 100644 --- a/core/src/commonMain/kotlin/behavior/ChatInputCommandBehavior.kt +++ b/core/src/commonMain/kotlin/behavior/ChatInputCommandBehavior.kt @@ -5,10 +5,16 @@ import dev.kord.core.entity.application.ChatInputCommandCommand import dev.kord.core.entity.application.GlobalChatInputCommand import dev.kord.core.entity.application.GuildChatInputCommand import dev.kord.rest.builder.interaction.ChatInputModifyBuilder +import dev.kord.rest.request.RestRequestException public interface ChatInputCommandBehavior : ApplicationCommandBehavior { + /** + * Requests to edit this command + * + * @throws [RestRequestException] when something goes wrong during the request. + */ public suspend fun edit(builder: suspend ChatInputModifyBuilder.() -> Unit): ChatInputCommandCommand } diff --git a/core/src/commonMain/kotlin/behavior/GlobalApplicationCommandBehavior.kt b/core/src/commonMain/kotlin/behavior/GlobalApplicationCommandBehavior.kt index 2c02ebd9632c..e4bc4ed50886 100644 --- a/core/src/commonMain/kotlin/behavior/GlobalApplicationCommandBehavior.kt +++ b/core/src/commonMain/kotlin/behavior/GlobalApplicationCommandBehavior.kt @@ -9,6 +9,7 @@ import dev.kord.rest.service.InteractionService * The behavior of an [Application Command](https://discord.com/developers/docs/interactions/application-commands). */ public interface ApplicationCommandBehavior : Entity { + /** THe ID of the application. */ public val applicationId: Snowflake public val service: InteractionService diff --git a/core/src/commonMain/kotlin/behavior/GuildBehavior.kt b/core/src/commonMain/kotlin/behavior/GuildBehavior.kt index efcb4287cd37..2d43cc22bffe 100644 --- a/core/src/commonMain/kotlin/behavior/GuildBehavior.kt +++ b/core/src/commonMain/kotlin/behavior/GuildBehavior.kt @@ -160,6 +160,13 @@ public interface GuildBehavior : KordEntity, Strategizable { public val members: Flow get() = supplier.getGuildMembers(id) + // TODO verify kdoc + /** + * Requests to get all present stickers for this guild. + * + * The returned flow is lazily executed, any [RestRequestException] will be thrown on + * [terminal operators](https://kotlinlang.org/docs/reference/coroutines/flow.html#terminal-flow-operators) instead. + */ public val stickers: Flow get() = supplier.getGuildStickers(id) @@ -211,6 +218,13 @@ public interface GuildBehavior : KordEntity, Strategizable { } } + // TODO verify kdoc + /** + * Requests to get all present templates for this guild. + * + * The returned flow is lazily executed, any [RestRequestException] will be thrown on + * [terminal operators](https://kotlinlang.org/docs/reference/coroutines/flow.html#terminal-flow-operators) instead. + */ public val templates: Flow