consumer = getDetailedDescription();
- if (consumer != null) {
- consumer.accept(builder);
- }
- }
-
- @Override
- public TextGeneratedValueSupplier getGeneratedValueSupplier(CommandPath commandPath,
- String optionName,
- ParameterType parameterType) {
- throw new IllegalArgumentException("Option '%s' in command path '%s' is a generated option but no generated value supplier has been given".formatted(optionName, commandPath.getFullPath()));
- }
-}
diff --git a/BotCommands-core/src/main/java/io/github/freya022/botcommands/api/localization/DefaultMessages.java b/BotCommands-core/src/main/java/io/github/freya022/botcommands/api/localization/DefaultMessages.java
deleted file mode 100644
index bb3bff4a4..000000000
--- a/BotCommands-core/src/main/java/io/github/freya022/botcommands/api/localization/DefaultMessages.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package io.github.freya022.botcommands.api.localization;
-
-import io.github.freya022.botcommands.api.localization.providers.LocalizationMapProvider;
-import io.github.freya022.botcommands.api.localization.readers.LocalizationMapReader;
-import io.github.freya022.botcommands.internal.core.exceptions.InternalException;
-import net.dv8tion.jda.api.Permission;
-import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
-import net.dv8tion.jda.api.utils.Timestamp;
-import org.jetbrains.annotations.ApiStatus;
-import org.jspecify.annotations.NullMarked;
-import org.jspecify.annotations.Nullable;
-
-import java.util.Locale;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static io.github.freya022.botcommands.api.localization.Localization.Entry.entry;
-
-/**
- * Helper class to translate framework-specific messages.
- *
- * The default values are contained in the {@code resources}, at {@code /bc_localization/DefaultMessages-default.json}.
- *
- *
You may change the default values by:
- *
- * - Creating a new {@code DefaultMessages.json}
- * - Creating language variations with a file of the same name, suffixed by the {@link Locale#toLanguageTag() locale tag},
- * for example {@code /bc_localization/DefaultMessages_fr.json}
- *
- *
- * You can always customize:
- *
- * - Loading directories: by creating new {@link LocalizationMapProvider LocalizationMap providers}
- * - File formats: by creating new {@link LocalizationMapReader LocalizationMap readers}
- * - Template formats: by creating new {@link LocalizationTemplate localization templates}
- *
- * Most of the time it's easier to just add your new localization files in {@code /bc_localization}.
- *
- * The localization paths must not be changed, the templates can have their values in any order,
- * use different format specifiers, but need to keep the same names.
- *
- *
Refer to {@link Localization} for more details.
- *
- * @see Localization
- *
- * @deprecated This has been replaced by {@link io.github.freya022.botcommands.api.core.messages.DefaultBotCommandsMessages DefaultBotCommandsMessages}
- */
-@NullMarked
-@Deprecated(since = "3.1.0-beta.1", forRemoval = true)
-public final class DefaultMessages {
- private final Localization localization;
-
- /**
- * THIS IS NOT A PUBLIC CONSTRUCTOR
- */
- @ApiStatus.Internal
- public DefaultMessages(LocalizationService localizationService, Locale locale) {
- var localization = localizationService.getInstance("DefaultMessages", locale);
- if (localization == null) {
- final var mappingProviders = localizationService.getMappingProviders();
- final var mappingReaders = localizationService.getMappingReaders();
- throw new InternalException("Could not load DefaultMessages, providers: " + mappingProviders + ", readers: " + mappingReaders);
- }
- this.localization = localization;
- }
-
- private LocalizationTemplate getLocalizationTemplate(String path) {
- final LocalizationTemplate template = getLocalizationTemplateOrNull(path);
- if (template == null) {
- throw new InternalException("Localization template for default messages '" + path + "' could not be found, available keys: " + localization.getKeys());
- }
-
- return template;
- }
-
- @Nullable
- private LocalizationTemplate getLocalizationTemplateOrNull(String path) {
- return localization.get(path);
- }
-
- /**
- * @return The localized permission, or {@link Permission#getName()} if the translation is missing.
- */
- public String getPermission(Permission permission) {
- final LocalizationTemplate localizationTemplate = getLocalizationTemplateOrNull("permissions." + permission.name());
- return localizationTemplate != null ? localizationTemplate.localize() : permission.getName();
- }
-
- /**
- * @return Message to display when an uncaught exception occurs
- */
- public String getGeneralErrorMsg() {
- return getLocalizationTemplate("general_error_message").localize();
- }
-
- /**
- * @return Message to display when the user does not have enough permissions
- */
- public String getUserPermErrorMsg(Set permissions) {
- final String localizedPermissions = permissions.stream().map(this::getPermission).collect(Collectors.joining(", "));
- return getLocalizationTemplate("user.perm.error.message").localize(entry("permissions", localizedPermissions));
- }
-
- /**
- * @return Message to display when the bot does not have enough permissions
- */
- public String getBotPermErrorMsg(Set permissions) {
- final String localizedPermissions = permissions.stream().map(this::getPermission).collect(Collectors.joining(", "));
- return getLocalizationTemplate("bot.perm.error.message").localize(entry("permissions", localizedPermissions));
- }
-
- /**
- * @return Message to display when the command is only usable by the owner
- */
- public String getOwnerOnlyErrorMsg() {
- return getLocalizationTemplate("owner.only.error.message").localize();
- }
-
- /**
- * @return Message to display when the command is on per-user rate limit
- */
- public String getUserRateLimitMsg(Timestamp timestamp) {
- return getLocalizationTemplate("user.rate_limit.message").localize(entry("delay", timestamp));
- }
-
- /**
- * @return Message to display when the command is on per-channel rate limit
- */
- public String getChannelRateLimitMsg(Timestamp timestamp) {
- return getLocalizationTemplate("channel.rate_limit.message").localize(entry("delay", timestamp));
- }
-
- /**
- * @return Message to display when the command is on per-guild rate limit
- */
- public String getGuildRateLimitMsg(Timestamp timestamp) {
- return getLocalizationTemplate("guild.rate_limit.message").localize(entry("delay", timestamp));
- }
-
- /**
- * @return Message to display when application commands are not loaded on the guild yet
- */
- public String getApplicationCommandsNotAvailableMsg() {
- return getLocalizationTemplate("application_commands_not_available").localize();
- }
-
- /**
- * @return Message to display when the command is not found
- */
- public String getCommandNotFoundMsg(String suggestions) {
- return getLocalizationTemplate("command.not.found.message").localize(entry("suggestions", suggestions));
- }
-
- /**
- * @return Message to display when a channel parameter could not be resolved
- */
- public String getResolverChannelNotFoundMsg() {
- return getLocalizationTemplate("resolver.channel.not_found.message").localize();
- }
-
- /**
- * @return Message to display when a channel parameter could not be resolved
- */
- public String getResolverChannelMissingAccessMsg(String channelMention) {
- return getLocalizationTemplate("resolver.channel.missing_access.message").localize(entry("channel_mention", channelMention));
- }
-
- /**
- * @return Message to display when a user parameter could not be resolved
- */
- public String getResolverUserNotFoundMsg() {
- return getLocalizationTemplate("resolver.user.not_found.message").localize();
- }
-
- /**
- * @return Message to display when a slash command option is unresolvable (only in slash command interactions)
- */
- public String getSlashCommandUnresolvableOptionMsg(String parameterName) {
- return getLocalizationTemplate("slash.command.unresolvable.option.message").localize(
- entry("optionName", parameterName)
- );
- }
-
- /**
- * @return Message to display when a User's DMs are closed (when sending help content for example)
- */
- public String getClosedDMErrorMsg() {
- return getLocalizationTemplate("closed.dm.error.message").localize();
- }
-
- /**
- * @return Message to display when a command is used in a non-NSFW {@link GuildMessageChannel}
- */
- public String getNSFWOnlyErrorMsg() {
- return getLocalizationTemplate("nsfw.only.error.message").localize();
- }
-
- /**
- * @return Message to display when a user tries to use a component it cannot interact with
- */
- public String getComponentNotAllowedErrorMsg() {
- return getLocalizationTemplate("component.not.allowed.error.message").localize();
- }
-
- /**
- * @return Message to display when a user tries to use a component which has reached timeout while the bot was offline
- */
- public String getComponentExpiredErrorMsg() {
- return getLocalizationTemplate("component.expired.error.message").localize();
- }
-
- /**
- * @return Message to display when a user tries to use a modal which has reached timeout
- */
- public String getModalExpiredErrorMsg() {
- return getLocalizationTemplate("modal.expired.error.message").localize();
- }
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt
deleted file mode 100644
index 6fb299881..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt
+++ /dev/null
@@ -1,43 +0,0 @@
-package io.github.freya022.botcommands.api.commands.application
-
-import io.github.freya022.botcommands.api.commands.CommandPath
-import io.github.freya022.botcommands.api.commands.application.context.annotations.JDAMessageCommand
-import io.github.freya022.botcommands.api.commands.application.context.annotations.JDAUserCommand
-import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand
-import io.github.freya022.botcommands.api.core.reflect.ParameterType
-import io.github.freya022.botcommands.internal.utils.throwArgument
-import net.dv8tion.jda.api.entities.Guild
-import net.dv8tion.jda.api.interactions.commands.Command
-
-/**
- * Base class for **annotated** application commands such as slash / context commands.
- *
- * You are not required to use this if you use the application command provider interfaces.
- *
- * @see JDASlashCommand @JDASlashCommand
- * @see JDAMessageCommand @JDAMessageCommand
- * @see JDAUserCommand @JDAUserCommand
- *
- * @see SlashOptionChoiceProvider
- */
-@Deprecated(message = "This superclass is no longer mandatory, if you override methods from it, implement them using their respective interfaces")
-abstract class ApplicationCommand : SlashOptionChoiceProvider, ApplicationGeneratedValueSupplierProvider {
- override fun getOptionChoices(guild: Guild?, commandPath: CommandPath, optionName: String): List {
- return emptyList()
- }
-
- override fun getGeneratedValueSupplier(
- guild: Guild?,
- commandId: String?, commandPath: CommandPath,
- optionName: String, parameterType: ParameterType
- ): ApplicationGeneratedValueSupplier {
- val errorStr = buildString {
- append("Option '$optionName' in command path '${commandPath.fullPath}'")
- if (commandId != null) append(" (id '$commandId')")
- if (guild != null) append(" in guild '${guild.name}' (id ${guild.id})")
- append(" is a generated option but no generated value supplier has been given")
- }
-
- throwArgument(errorStr)
- }
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BApplicationConfig.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BApplicationConfig.kt
index a99f9dbfa..ab5d23bdc 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BApplicationConfig.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BApplicationConfig.kt
@@ -19,7 +19,6 @@ import io.github.freya022.botcommands.api.localization.readers.JacksonLocalizati
import io.github.freya022.botcommands.api.localization.readers.LocalizationMapReader
import io.github.freya022.botcommands.internal.core.config.ConfigDSL
import io.github.freya022.botcommands.internal.core.config.ConfigurationValue
-import io.github.freya022.botcommands.internal.core.config.DeprecatedValue
import io.github.freya022.botcommands.internal.core.exceptions.internalErrorMessage
import io.github.freya022.botcommands.internal.utils.lazyWritable
import io.github.freya022.botcommands.internal.utils.throwInternal
@@ -48,18 +47,6 @@ interface BApplicationConfigProps {
@ConfigurationValue(path = "botcommands.application.enable", defaultValue = "true")
val enable: Boolean
- /**
- * If not empty, only these guilds will have their application commands updated.
- *
- * Existing commands won't be removed in other guilds, global commands will still be updated.
- *
- * Spring property: `botcommands.application.slashGuildIds`
- */
- @Deprecated("Replaced by 'guildsToUpdate'", replaceWith = ReplaceWith("guildToUpdate"))
- @DeprecatedValue("Replaced by 'guildsToUpdate'", replacement = "botcommands.application.slashGuildIds")
- @ConfigurationValue(path = "botcommands.application.slashGuildIds")
- val slashGuildIds: List get() = guildsToUpdate
-
/**
* If not empty, application commands will only be updated in these guilds.
*
@@ -164,8 +151,6 @@ interface BApplicationConfigProps {
class BApplicationConfigBuilder internal constructor() : BApplicationConfigProps {
@set:JvmName("enable")
override var enable: Boolean = true
- @Deprecated("Replaced by 'guildsToUpdate'", replaceWith = ReplaceWith("guildToUpdate"))
- override val slashGuildIds: MutableList get() = guildsToUpdate
override val guildsToUpdate: MutableList = mutableListOf()
override val testGuildIds: MutableList = mutableListOf()
@set:DevConfig
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BConfig.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BConfig.kt
index 9162d7c21..86eae9ccb 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BConfig.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/config/BConfig.kt
@@ -9,14 +9,11 @@ import io.github.freya022.botcommands.api.core.requests.PriorityGlobalRestRateLi
import io.github.freya022.botcommands.api.core.service.ClassGraphProcessor
import io.github.freya022.botcommands.api.core.service.annotations.InjectedService
import io.github.freya022.botcommands.api.core.utils.*
-import io.github.freya022.botcommands.api.core.waiter.EventWaiter
import io.github.freya022.botcommands.internal.core.config.ConfigDSL
import io.github.freya022.botcommands.internal.core.config.ConfigurationValue
-import io.github.freya022.botcommands.internal.core.config.DeprecatedValue
import io.github.freya022.botcommands.internal.utils.putIfAbsentOrThrow
import io.github.freya022.botcommands.internal.utils.throwInternal
import io.github.oshai.kotlinlogging.KotlinLogging
-import net.dv8tion.jda.api.events.Event
import net.dv8tion.jda.api.requests.GatewayIntent
import net.dv8tion.jda.api.requests.RestRateLimiter
import net.dv8tion.jda.api.utils.messages.MessageCreateData
@@ -112,18 +109,6 @@ interface BConfigProps {
@ConfigurationValue(path = "botcommands.core.ignoredIntents")
val ignoredIntents: Set
- /**
- * Events for which the [event waiter][EventWaiter] must ignore intent requirements.
- *
- * If not ignored, the event would still be being listened to, but a warning would have been logged.
- *
- * Spring property: `botcommands.core.ignoredEventIntents`
- */
- @Deprecated("Replaced by EventWaiterBuilder.ignoreMissingIntents()")
- @DeprecatedValue("Replaced by EventWaiterBuilder.ignoreMissingIntents()")
- @ConfigurationValue(path = "botcommands.core.ignoredEventIntents", type = "java.util.Set>")
- val ignoredEventIntents: Set>
-
/**
* Suppresses warnings about the default [RestRateLimiter] being used for large bots.
*
@@ -179,9 +164,6 @@ class BConfigBuilder : BConfigProps {
override val ignoredIntents: MutableSet = enumSetOf()
- @Deprecated("Replaced by EventWaiterBuilder.ignoreMissingIntents()")
- override val ignoredEventIntents: MutableSet> = hashSetOf()
-
override var ignoreRestRateLimiter: Boolean = false
override val classGraphProcessors: MutableList = arrayListOf()
@@ -356,8 +338,6 @@ class BConfigBuilder : BConfigProps {
override val disableExceptionsInDMs = this@BConfigBuilder.disableExceptionsInDMs
override val enableOwnerBypass = this@BConfigBuilder.enableOwnerBypass
override val ignoredIntents = this@BConfigBuilder.ignoredIntents.toImmutableSet()
- @Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
- override val ignoredEventIntents = this@BConfigBuilder.ignoredEventIntents.toImmutableSet()
override val ignoreRestRateLimiter = this@BConfigBuilder.ignoreRestRateLimiter
override val classGraphProcessors = this@BConfigBuilder.classGraphProcessors.toImmutableList()
override val enableShutdownHook = this@BConfigBuilder.enableShutdownHook
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/messages/BotCommandsMessagesFactory.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/messages/BotCommandsMessagesFactory.kt
index 1cfaa5f56..2e309b137 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/messages/BotCommandsMessagesFactory.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/messages/BotCommandsMessagesFactory.kt
@@ -1,9 +1,6 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.core.messages
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
@@ -11,8 +8,7 @@ import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
/**
- * Factory of [BotCommandsMessages], the default implementation is [DefaultBotCommandsMessagesFactory], or,
- * if a non-default [DefaultMessagesFactory] exists, an adapter is used.
+ * Factory of [BotCommandsMessages], the default implementation is [DefaultBotCommandsMessagesFactory].
*
* ### Complete customization
*
@@ -40,4 +36,4 @@ interface BotCommandsMessagesFactory {
* By default, this uses [UserLocaleProvider] to get the locale.
*/
fun get(event: Interaction): BotCommandsMessages
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/service/DefaultServiceContainer.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/service/DefaultServiceContainer.kt
deleted file mode 100644
index 048071a10..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/service/DefaultServiceContainer.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package io.github.freya022.botcommands.api.core.service
-
-@Deprecated("Renamed to BCServiceContainer", ReplaceWith("BCServiceContainer"))
-interface DefaultServiceContainer : BCServiceContainer
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/waiter/EventWaiter.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/waiter/EventWaiter.kt
index b652e9ef2..16a708ecb 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/waiter/EventWaiter.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/waiter/EventWaiter.kt
@@ -1,6 +1,5 @@
package io.github.freya022.botcommands.api.core.waiter
-import io.github.freya022.botcommands.api.core.config.BConfigBuilder
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import kotlinx.coroutines.future.await
import net.dv8tion.jda.api.JDA
@@ -45,8 +44,6 @@ import net.dv8tion.jda.api.events.message.MessageReceivedEvent
* LOGGER.error("Error waiting for event", e);
* }
* ```
- *
- * @see BConfigBuilder.ignoredEventIntents
*/
@InterfacedService(acceptMultiple = false)
interface EventWaiter {
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/DefaultMessagesFactory.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/DefaultMessagesFactory.kt
deleted file mode 100644
index 0a52848b2..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/DefaultMessagesFactory.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-@file:Suppress("removal", "DEPRECATION")
-
-package io.github.freya022.botcommands.api.localization
-
-import io.github.freya022.botcommands.api.core.service.annotations.BService
-import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
-import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
-import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.Interaction
-import java.util.*
-
-/**
- * Factory for [DefaultMessages] instances, using locales from various sources.
- *
- * **Usage:** Register your instance as a service with [@BService][BService].
- *
- * @see InterfacedService @InterfacedService
- */
-@Deprecated("Replaced by BotCommandsMessagesFactory")
-@InterfacedService(acceptMultiple = false)
-interface DefaultMessagesFactory {
- /**
- * Retrieves a [DefaultMessages] instance for the given locale.
- */
- fun get(locale: Locale): DefaultMessages
-
- /**
- * Retrieves a [DefaultMessages] instance, with the locale derived from this event.
- *
- * By default, this uses [TextCommandLocaleProvider] to get the locale.
- */
- fun get(event: MessageReceivedEvent): DefaultMessages
-
- /**
- * Retrieves a [DefaultMessages] instance, with the locale derived from this interaction.
- *
- * By default, this uses [UserLocaleProvider] to get the locale.
- */
- fun get(event: Interaction): DefaultMessages
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/LocalizableAction.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/LocalizableAction.kt
index a5d1edf8d..b6538cc4c 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/LocalizableAction.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/LocalizableAction.kt
@@ -6,7 +6,6 @@ import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFacto
import io.github.freya022.botcommands.api.localization.context.LocalizationContext
import io.github.freya022.botcommands.api.localization.context.PairEntry
import io.github.freya022.botcommands.api.localization.context.mapToEntries
-import net.dv8tion.jda.api.interactions.DiscordLocale
import java.util.*
/**
@@ -40,15 +39,6 @@ interface LocalizableAction {
*/
fun getLocalizationContext(bundleName: String, pathPrefix: String?): LocalizationContext
- /**
- * Retrieves a [DefaultMessages] instance, using a locale suitable for messages sent to the user.
- *
- * @see DefaultMessagesFactory
- */
- @Suppress("DEPRECATION", "removal")
- @Deprecated("Replaced with getBotCommandsMessages()")
- fun getDefaultMessages(): DefaultMessages
-
/**
* Retrieves a [BotCommandsMessages] instance, using a locale suitable for messages sent to the user.
*
@@ -79,38 +69,7 @@ interface LocalizableAction {
* - If the template requires an argument that was not passed to [entries]
*/
fun getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): String
-
- /**
- * Returns the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param locale The locale to translate the message to
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][localizationPrefix] unless starting with `/`
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- fun getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): String =
- getLocalizedMessage(locale.toLocale(), localizationPath, *entries)
}
fun LocalizableAction.getLocalizedMessage(locale: Locale, localizationPath: String, vararg entries: PairEntry): String =
getLocalizedMessage(locale, localizationPath, *entries.mapToEntries())
-
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableAction.getLocalizedMessage(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry): String =
- getLocalizedMessage(locale, localizationPath, *entries.mapToEntries())
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/AppLocalizationContext.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/AppLocalizationContext.kt
index 039fe9dd4..f073d25dd 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/AppLocalizationContext.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/AppLocalizationContext.kt
@@ -1,12 +1,9 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.localization.context
import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.annotations.LocalizationBundle
import io.github.freya022.botcommands.api.localization.interaction.GuildLocaleProvider
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
import javax.annotation.CheckReturnValue
@@ -45,10 +42,6 @@ interface AppLocalizationContext : TextLocalizationContext {
//User locale is always provided in interactions
val userLocale: Locale
- @Deprecated("Use the Locale overload")
- @CheckReturnValue
- override fun withGuildLocale(guildLocale: DiscordLocale?): AppLocalizationContext
-
@CheckReturnValue
override fun withGuildLocale(guildLocale: Locale?): AppLocalizationContext
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/LocalizationContext.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/LocalizationContext.kt
index c0b3d93e3..e2ed34778 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/LocalizationContext.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/context/LocalizationContext.kt
@@ -1,5 +1,3 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.localization.context
import io.github.freya022.botcommands.api.commands.text.BaseCommandEvent
@@ -17,7 +15,6 @@ import net.dv8tion.jda.api.entities.Guild
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import net.dv8tion.jda.api.interactions.InteractionHook
import net.dv8tion.jda.api.interactions.callbacks.IMessageEditCallback
@@ -72,15 +69,6 @@ interface LocalizationContext {
*/
val localizationPrefix: String?
- /**
- * Returns a new [TextLocalizationContext] with the specified guild locale.
- *
- * @param guildLocale The guild locale to use, or `null` to remove it
- */
- @Deprecated("Use the Locale overload")
- @CheckReturnValue
- fun withGuildLocale(guildLocale: DiscordLocale?): TextLocalizationContext
-
/**
* Returns a new [TextLocalizationContext] with the specified guild locale.
*
@@ -89,15 +77,6 @@ interface LocalizationContext {
@CheckReturnValue
fun withGuildLocale(guildLocale: Locale?): TextLocalizationContext
- /**
- * Returns a new [AppLocalizationContext] with the specified user locale.
- *
- * @param userLocale The user locale to use, or `null` to remove it
- */
- @Deprecated("Use the Locale overload")
- @CheckReturnValue
- fun withUserLocale(userLocale: DiscordLocale?): AppLocalizationContext
-
/**
* Returns a new [AppLocalizationContext] with the specified user locale.
*
@@ -131,18 +110,6 @@ interface LocalizationContext {
@CheckReturnValue
fun switchBundle(localizationBundle: String): LocalizationContext
- /**
- * Localizes the provided path, with the provided locale.
- *
- * @param locale The [DiscordLocale] to use when fetching the localization bundle
- * @param localizationPath The path of the localization template,
- * prefixed with [localizationPrefix][LocalizationContext.localizationPrefix] unless starting with `/`
- * @param entries The entries to fill the template with
- */
- @Deprecated("Use the Locale overload")
- fun localize(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): String
- = localize(locale.toLocale(), localizationPath, *entries)
-
/**
* Localizes the provided path, with the provided locale.
*
@@ -153,18 +120,6 @@ interface LocalizationContext {
*/
fun localize(locale: Locale, localizationPath: String, vararg entries: Localization.Entry): String
- /**
- * Localizes the provided path, with the provided locale, or returns `null` if the path does not exist.
- *
- * @param locale The [DiscordLocale] to use when fetching the localization bundle
- * @param localizationPath The path of the localization template,
- * prefixed with [localizationPrefix][LocalizationContext.localizationPrefix] unless starting with `/`
- * @param entries The entries to fill the template with
- */
- @Deprecated("Use the Locale overload")
- fun localizeOrNull(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): String?
- = localizeOrNull(locale.toLocale(), localizationPath, *entries)
-
/**
* Localizes the provided path, with the provided locale, or returns `null` if the path does not exist.
*
@@ -267,81 +222,6 @@ interface LocalizationContext {
}
companion object {
- @JvmStatic
- @JvmOverloads
- @Deprecated("Replaced by builder")
- fun create(
- context: BContext,
- localizationBundle: String,
- localizationPrefix: String? = null,
- guildLocale: DiscordLocale? = null,
- userLocale: DiscordLocale? = null
- ): AppLocalizationContext {
- return LocalizationContextImpl(
- context.getService(),
- localizationBundle,
- localizationPrefix,
- guildLocale?.toProvider(),
- userLocale?.toProvider()
- )
- }
-
- @JvmStatic
- @JvmOverloads
- @Deprecated("Replaced by builder")
- fun create(
- localizationService: LocalizationService,
- localizationBundle: String,
- localizationPrefix: String? = null,
- guildLocale: DiscordLocale? = null,
- userLocale: DiscordLocale? = null
- ): AppLocalizationContext {
- return LocalizationContextImpl(
- localizationService,
- localizationBundle,
- localizationPrefix,
- guildLocale?.toProvider(),
- userLocale?.toProvider()
- )
- }
-
- @JvmStatic
- @JvmOverloads
- @Deprecated("Replaced by builder")
- fun fromLocaleProviders(
- context: BContext,
- event: Interaction,
- localizationBundle: String,
- localizationPrefix: String? = null
- ): AppLocalizationContext {
- return LocalizationContextImpl(
- context.getService(),
- localizationBundle,
- localizationPrefix,
- lazy { context.getService().getLocale(event) },
- lazy { context.getService().getLocale(event) },
- )
- }
-
- @JvmStatic
- @JvmOverloads
- @Deprecated("Replaced by builder")
- fun fromLocaleProviders(
- context: BContext,
- event: MessageReceivedEvent,
- localizationBundle: String,
- localizationPrefix: String? = null,
- userLocale: DiscordLocale? = null,
- ): TextLocalizationContext {
- return LocalizationContextImpl(
- context.getService(),
- localizationBundle,
- localizationPrefix,
- lazy { context.getService().getLocale(event) },
- userLocale?.toProvider(),
- )
- }
-
/**
* Creates a new builder, using a [LocalizationService] retrieved from the provided context,
* and the specified bundle name, from which the strings will be retrieved from.
@@ -359,8 +239,6 @@ interface LocalizationContext {
fun builder(localizationService: LocalizationService, localizationBundle: String): Builder {
return Builder(localizationService, localizationBundle)
}
-
- private fun DiscordLocale.toProvider(): Lazy = lazyOf(this.toLocale())
}
}
@@ -368,18 +246,6 @@ internal fun Array.mapToEntries() = Array(this.size) {
Localization.Entry(this[it].first, this[it].second)
}
-/**
- * Localizes the provided path, with the provided locale.
- *
- * @param locale The [DiscordLocale] to use when fetching the localization bundle
- * @param localizationPath The path of the localization template,
- * prefixed with [localizationPrefix][LocalizationContext.localizationPrefix] unless starting with `/`
- * @param entries The entries to fill the template with
- */
-@Deprecated("Use the Locale overload")
-fun LocalizationContext.localize(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry): String =
- localize(locale, localizationPath, *entries.mapToEntries())
-
/**
* Localizes the provided path, with the provided locale.
*
@@ -391,18 +257,6 @@ fun LocalizationContext.localize(locale: DiscordLocale, localizationPath: String
fun LocalizationContext.localize(locale: Locale, localizationPath: String, vararg entries: PairEntry): String =
localize(locale, localizationPath, *entries.mapToEntries())
-/**
- * Localizes the provided path, with the provided locale, or returns `null` if the path does not exist.
- *
- * @param locale The [DiscordLocale] to use when fetching the localization bundle
- * @param localizationPath The path of the localization template,
- * prefixed with [localizationPrefix][LocalizationContext.localizationPrefix] unless starting with `/`
- * @param entries The entries to fill the template with
- */
-@Deprecated("Use the Locale overload")
-fun LocalizationContext.localizeOrNull(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry): String? =
- localizeOrNull(locale, localizationPath, *entries.mapToEntries())
-
/**
* Localizes the provided path, with the provided locale, or returns `null` if the path does not exist.
*
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/GuildLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/GuildLocaleProvider.kt
index ba7ae8797..91c789ab5 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/GuildLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/GuildLocaleProvider.kt
@@ -4,18 +4,15 @@ import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import io.github.freya022.botcommands.api.localization.context.AppLocalizationContext
import io.github.freya022.botcommands.api.localization.context.TextLocalizationContext
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
/**
- * Provides the locale of a guild in a Discord interaction,
- * may be useful if the guild has set its own locale, for example.
+ * Provides the locale of a guild in a Discord interaction.
*
- * It is recommended to override both [getDiscordLocale] and [getLocale] for best results,
- * when using localization in events, and in [AppLocalizationContext].
+ * You may provide a custom implementation, for example, if a guild's locale depends on some external setting.
*
- * This returns [Interaction.getGuildLocale] by default.
+ * This returns [interaction.getGuildLocale().toLocale()][Interaction.getGuildLocale] by default.
*
* ### Usage
* Register your instance as a service with [@BService][BService].
@@ -26,11 +23,5 @@ import java.util.*
*/
@InterfacedService(acceptMultiple = false)
interface GuildLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- fun getDiscordLocale(interaction: Interaction): DiscordLocale =
- throw UnsupportedOperationException("'getLocale' needs to be implemented instead")
-
- @Suppress("DEPRECATION")
- fun getLocale(interaction: Interaction): Locale =
- getDiscordLocale(interaction).toLocale()
+ fun getLocale(interaction: Interaction): Locale
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableEditCallback.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableEditCallback.kt
index 8ca944ae7..098a217bc 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableEditCallback.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableEditCallback.kt
@@ -4,7 +4,6 @@ import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.context.PairEntry
import io.github.freya022.botcommands.api.localization.context.mapToEntries
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.requests.restaction.interactions.MessageEditCallbackAction
import java.util.*
import javax.annotation.CheckReturnValue
@@ -74,32 +73,6 @@ interface LocalizableEditCallback {
@CheckReturnValue
fun editGuild(localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction
- /**
- * Edits the original message with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableInteraction.localizationPrefix] unless starting with `/`
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun editLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageEditCallbackAction =
- editLocalized(locale.toLocale(), localizationPath, *entries)
-
/**
* Edits the original message with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -181,32 +154,6 @@ fun LocalizableEditCallback.editUser(localizationPath: String, vararg entries: P
fun LocalizableEditCallback.editGuild(localizationPath: String, vararg entries: PairEntry) =
editGuild(localizationPath, *entries.mapToEntries())
-/**
- * Edits the original message with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableInteraction.localizationPrefix] unless starting with `/`
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableEditCallback.editLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- editLocalized(locale, localizationPath, *entries.mapToEntries())
-
/**
* Edits the original message with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableInteractionHook.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableInteractionHook.kt
index cfb76251d..2f2b7d314 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableInteractionHook.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableInteractionHook.kt
@@ -5,7 +5,6 @@ import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.context.PairEntry
import io.github.freya022.botcommands.api.localization.context.mapToEntries
import net.dv8tion.jda.api.entities.Message
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.InteractionHook
import net.dv8tion.jda.api.requests.restaction.WebhookMessageCreateAction
import net.dv8tion.jda.api.requests.restaction.WebhookMessageEditAction
@@ -81,31 +80,6 @@ interface LocalizableInteractionHook : InteractionHook {
@CheckReturnValue
fun sendGuild(localizationPath: String, vararg entries: Localization.Entry): WebhookMessageCreateAction
- /**
- * Sends a follow-up with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate, will be prefixed with [LocalizableInteraction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun sendLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): WebhookMessageCreateAction =
- sendLocalized(locale.toLocale(), localizationPath, *entries)
-
/**
* Sends a follow-up with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -183,31 +157,6 @@ interface LocalizableInteractionHook : InteractionHook {
@CheckReturnValue
fun editGuild(localizationPath: String, vararg entries: Localization.Entry): WebhookMessageEditAction
- /**
- * Edits the original message with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate, will be prefixed with [LocalizableInteraction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun editLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): WebhookMessageEditAction =
- editLocalized(locale.toLocale(), localizationPath, *entries)
-
/**
* Edits the original message with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -286,31 +235,6 @@ fun LocalizableInteractionHook.sendUser(localizationPath: String, vararg entries
fun LocalizableInteractionHook.sendGuild(localizationPath: String, vararg entries: PairEntry) =
sendGuild(localizationPath, *entries.mapToEntries())
-/**
- * Sends a follow-up with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate, will be prefixed with [LocalizableInteraction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableInteractionHook.sendLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- sendLocalized(locale, localizationPath, *entries.mapToEntries())
-
/**
* Sends a follow-up with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -388,31 +312,6 @@ fun LocalizableInteractionHook.editUser(localizationPath: String, vararg entries
fun LocalizableInteractionHook.editGuild(localizationPath: String, vararg entries: PairEntry) =
editGuild(localizationPath, *entries.mapToEntries())
-/**
- * Edits the original message with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate, will be prefixed with [LocalizableInteraction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableInteractionHook.editLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- editLocalized(locale, localizationPath, *entries.mapToEntries())
-
/**
* Edits the original message with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableReplyCallback.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableReplyCallback.kt
index 8dbca4697..85d20d09d 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableReplyCallback.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/LocalizableReplyCallback.kt
@@ -4,7 +4,6 @@ import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.context.PairEntry
import io.github.freya022.botcommands.api.localization.context.mapToEntries
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.requests.restaction.interactions.ReplyCallbackAction
import java.util.*
import javax.annotation.CheckReturnValue
@@ -74,32 +73,6 @@ interface LocalizableReplyCallback {
@CheckReturnValue
fun replyGuild(localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction
- /**
- * Replies with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableInteraction.localizationPrefix] unless starting with `/`
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): ReplyCallbackAction =
- replyLocalized(locale.toLocale(), localizationPath, *entries)
-
/**
* Replies with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -181,32 +154,6 @@ fun LocalizableReplyCallback.replyUser(localizationPath: String, vararg entries:
fun LocalizableReplyCallback.replyGuild(localizationPath: String, vararg entries: PairEntry) =
replyGuild(localizationPath, *entries.mapToEntries())
-/**
- * Replies with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableInteraction.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableInteraction.localizationPrefix] unless starting with `/`
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableInteraction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableReplyCallback.replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- replyLocalized(locale, localizationPath, *entries.mapToEntries())
-
/**
* Replies with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/UserLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/UserLocaleProvider.kt
index 6bb945de8..8a5133070 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/UserLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/interaction/UserLocaleProvider.kt
@@ -3,18 +3,15 @@ package io.github.freya022.botcommands.api.localization.interaction
import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import io.github.freya022.botcommands.api.localization.context.AppLocalizationContext
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
/**
- * Provides the locale of a user in a Discord interaction,
- * may be useful if the user has set its own locale, for example.
+ * Provides the locale of a user in a Discord interaction.
*
- * It is recommended to override both [getDiscordLocale] and [getLocale] for best results,
- * when using localization in events, and in [AppLocalizationContext].
+ * You may provide a custom implementation, for example, if a user's locale depends on some external setting.
*
- * This returns [Interaction.getUserLocale] by default.
+ * This returns [interaction.getUserLocale().toLocale()][Interaction.getUserLocale] by default.
*
* ### Usage
* Register your instance as a service with [@BService][BService].
@@ -24,11 +21,5 @@ import java.util.*
*/
@InterfacedService(acceptMultiple = false)
interface UserLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- fun getDiscordLocale(interaction: Interaction): DiscordLocale =
- throw UnsupportedOperationException("'getLocale' needs to be implemented instead")
-
- @Suppress("DEPRECATION")
- fun getLocale(interaction: Interaction): Locale =
- getDiscordLocale(interaction).toLocale()
+ fun getLocale(interaction: Interaction): Locale
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/LocalizableTextCommand.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/LocalizableTextCommand.kt
index 9a294ba50..acab8d1d9 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/LocalizableTextCommand.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/LocalizableTextCommand.kt
@@ -7,7 +7,6 @@ import io.github.freya022.botcommands.api.localization.context.PairEntry
import io.github.freya022.botcommands.api.localization.context.TextLocalizationContext
import io.github.freya022.botcommands.api.localization.context.mapToEntries
import net.dv8tion.jda.api.entities.Guild
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.requests.restaction.MessageCreateAction
import java.util.*
import javax.annotation.CheckReturnValue
@@ -116,58 +115,6 @@ interface LocalizableTextCommand : LocalizableAction {
@CheckReturnValue
fun replyGuild(localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction
- /**
- * Responds with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableAction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableAction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun respondLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction =
- respondLocalized(locale.toLocale(), localizationPath, *entries)
-
- /**
- * Replies with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableAction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableAction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
- @Deprecated("Pass a Locale instead")
- @CheckReturnValue
- fun replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: Localization.Entry): MessageCreateAction =
- replyLocalized(locale.toLocale(), localizationPath, *entries)
-
/**
* Responds with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
@@ -301,58 +248,6 @@ fun LocalizableTextCommand.respondGuild(localizationPath: String, vararg entries
fun LocalizableTextCommand.replyGuild(localizationPath: String, vararg entries: PairEntry) =
replyGuild(localizationPath, *entries.mapToEntries())
-/**
- * Responds with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableTextCommand.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableAction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableAction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableTextCommand.respondLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- respondLocalized(locale, localizationPath, *entries.mapToEntries())
-
-/**
- * Replies with the localized message at the following [path][localizationPath],
- * using the provided locale and parameters.
- *
- * ### Bundle resolution
- * The bundle used is either the [defined bundle][LocalizableTextCommand.localizationBundle]
- * or one of the [registered bundles][BLocalizationConfig.responseBundles].
- *
- * The locale of the bundle is the best available,
- * for example, if `fr_FR` is not available, then `fr` will be used,
- * and otherwise, the root bundle (without any suffix) will be used.
- *
- * @param localizationPath The path of the message to translate,
- * will be prefixed with [localizationPrefix][LocalizableAction.localizationPrefix]
- * @param entries The values replacing arguments of the localization template
- *
- * @throws IllegalArgumentException If:
- * - [localizationBundle][LocalizableAction.localizationBundle] is set, but the bundle doesn't exist
- * - No [registered bundle][BLocalizationConfig.responseBundles] containing the path could be found
- * - If the template requires an argument that was not passed to [entries]
- */
-@Suppress("DEPRECATION")
-@Deprecated("Pass a Locale instead")
-fun LocalizableTextCommand.replyLocalized(locale: DiscordLocale, localizationPath: String, vararg entries: PairEntry) =
- replyLocalized(locale, localizationPath, *entries.mapToEntries())
-
/**
* Responds with the localized message at the following [path][localizationPath],
* using the provided locale and parameters.
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/TextCommandLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/TextCommandLocaleProvider.kt
index 17fd289ef..2766b1b36 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/TextCommandLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/text/TextCommandLocaleProvider.kt
@@ -2,20 +2,16 @@ package io.github.freya022.botcommands.api.localization.text
import io.github.freya022.botcommands.api.core.service.annotations.BService
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
-import io.github.freya022.botcommands.api.localization.context.TextLocalizationContext
import net.dv8tion.jda.api.entities.Guild
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.DiscordLocale
import java.util.*
/**
- * Provides the locale to be used for localizing text command responses,
- * may be useful if the user has set its own locale, for example.
+ * Provides the locale to be used for localizing text command responses.
*
- * It is recommended to override both [getDiscordLocale] and [getLocale] for best results,
- * when using localization in events, and in [TextLocalizationContext].
+ * You may provide a custom implementation, for example, if a guild/user's locale depends on some external setting.
*
- * This returns [Guild.getLocale] by default.
+ * This returns [guild.getLocale().toLocale()][Guild.getLocale] by default.
*
* ### Usage
* Register your instance as a service with [@BService][BService].
@@ -24,11 +20,5 @@ import java.util.*
*/
@InterfacedService(acceptMultiple = false)
interface TextCommandLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- fun getDiscordLocale(event: MessageReceivedEvent): DiscordLocale =
- throw UnsupportedOperationException("'getLocale' needs to be implemented instead")
-
- @Suppress("DEPRECATION")
- fun getLocale(event: MessageReceivedEvent): Locale =
- getDiscordLocale(event).toLocale()
+ fun getLocale(event: MessageReceivedEvent): Locale
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/pagination/UsedComponentSet.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/pagination/UsedComponentSet.kt
index 020359063..615fc852b 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/pagination/UsedComponentSet.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/pagination/UsedComponentSet.kt
@@ -1,14 +1,12 @@
package io.github.freya022.botcommands.api.pagination
import dev.freya02.botcommands.jda.ktx.components.findAll
-import dev.freya02.botcommands.jda.ktx.components.toDefaultComponentTree
import gnu.trove.set.hash.TIntHashSet
import io.github.freya022.botcommands.api.components.Components
import io.github.freya022.botcommands.api.components.IdentifiableComponent
import io.github.freya022.botcommands.internal.utils.any
import io.github.freya022.botcommands.internal.utils.reference
import io.github.oshai.kotlinlogging.KotlinLogging
-import net.dv8tion.jda.api.components.Component
import net.dv8tion.jda.api.components.attribute.ICustomId
import net.dv8tion.jda.api.components.tree.ComponentTree
import kotlin.reflect.KProperty
@@ -21,17 +19,6 @@ private val logger = KotlinLogging.logger { }
class UsedComponentSet(private val componentsService: Components, private val cleanAfterRefresh: Boolean) {
private lateinit var currentIds: TIntHashSet
- @Deprecated(
- message = "Replaced with setComponent(ComponentTree), if you have a message, you should get the ComponentTree directly from it",
- replaceWith = ReplaceWith(
- expression = "setComponents(components.toList().toDefaultComponentTree())",
- imports = arrayOf("dev.freya02.botcommands.jda.ktx.components.toDefaultComponentTree")
- )
- )
- fun setComponents(components: Iterable) {
- return setComponents(components.toList().toDefaultComponentTree())
- }
-
fun setComponents(componentTree: ComponentTree<*>) {
val newIds = TIntHashSet().apply {
componentTree
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/builder/MessageCommandBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/builder/MessageCommandBuilderImpl.kt
index d66e26262..ae9e379d1 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/builder/MessageCommandBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/builder/MessageCommandBuilderImpl.kt
@@ -32,9 +32,9 @@ internal class MessageCommandBuilderImpl internal constructor(
}
override fun constructAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
- MessageCommandOptionAggregateBuilderImpl(context, this, aggregatorParameter, aggregator)
+ MessageCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
internal fun build(): MessageCommandInfoImpl {
return MessageCommandInfoImpl(context, this)
}
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/options/builder/MessageCommandOptionAggregateBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/options/builder/MessageCommandOptionAggregateBuilderImpl.kt
index 15e4f740b..da408309e 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/options/builder/MessageCommandOptionAggregateBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/message/options/builder/MessageCommandOptionAggregateBuilderImpl.kt
@@ -2,16 +2,12 @@ package io.github.freya022.botcommands.internal.commands.application.context.mes
import io.github.freya022.botcommands.api.commands.application.ApplicationGeneratedValueSupplier
import io.github.freya022.botcommands.api.commands.application.context.message.options.builder.MessageCommandOptionAggregateBuilder
-import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationCommandOptionAggregateBuilderImpl
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationGeneratedOptionBuilderImpl
import io.github.freya022.botcommands.internal.parameters.AggregatorParameter
import kotlin.reflect.KFunction
internal class MessageCommandOptionAggregateBuilderImpl internal constructor(
- override val context: BContext,
- override val declarationSiteHolder: IDeclarationSiteHolder,
aggregatorParameter: AggregatorParameter,
aggregator: KFunction<*>
) : ApplicationCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator),
@@ -29,5 +25,5 @@ internal class MessageCommandOptionAggregateBuilderImpl internal constructor(
}
override fun constructNestedAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
- MessageCommandOptionAggregateBuilderImpl(context, declarationSiteHolder, aggregatorParameter, aggregator)
-}
\ No newline at end of file
+ MessageCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/builder/UserCommandBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/builder/UserCommandBuilderImpl.kt
index 93f4d650e..184bdf54b 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/builder/UserCommandBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/builder/UserCommandBuilderImpl.kt
@@ -32,9 +32,9 @@ internal class UserCommandBuilderImpl internal constructor(
}
override fun constructAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
- UserCommandOptionAggregateBuilderImpl(context, this, aggregatorParameter, aggregator)
+ UserCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
internal fun build(): UserCommandInfoImpl {
return UserCommandInfoImpl(context, this)
}
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/options/builder/UserCommandOptionAggregateBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/options/builder/UserCommandOptionAggregateBuilderImpl.kt
index 717376cba..e6de31de9 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/options/builder/UserCommandOptionAggregateBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/context/user/options/builder/UserCommandOptionAggregateBuilderImpl.kt
@@ -2,16 +2,12 @@ package io.github.freya022.botcommands.internal.commands.application.context.use
import io.github.freya022.botcommands.api.commands.application.ApplicationGeneratedValueSupplier
import io.github.freya022.botcommands.api.commands.application.context.user.options.builder.UserCommandOptionAggregateBuilder
-import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationCommandOptionAggregateBuilderImpl
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationGeneratedOptionBuilderImpl
import io.github.freya022.botcommands.internal.parameters.AggregatorParameter
import kotlin.reflect.KFunction
internal class UserCommandOptionAggregateBuilderImpl internal constructor(
- override val context: BContext,
- override val declarationSiteHolder: IDeclarationSiteHolder,
aggregatorParameter: AggregatorParameter,
aggregator: KFunction<*>
) : ApplicationCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator),
@@ -29,5 +25,5 @@ internal class UserCommandOptionAggregateBuilderImpl internal constructor(
}
override fun constructNestedAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
- UserCommandOptionAggregateBuilderImpl(context, declarationSiteHolder, aggregatorParameter, aggregator)
-}
\ No newline at end of file
+ UserCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/slash/options/builder/SlashCommandOptionAggregateBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/slash/options/builder/SlashCommandOptionAggregateBuilderImpl.kt
index b2800c05f..5a781fb28 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/slash/options/builder/SlashCommandOptionAggregateBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/slash/options/builder/SlashCommandOptionAggregateBuilderImpl.kt
@@ -4,7 +4,6 @@ import io.github.freya022.botcommands.api.commands.application.ApplicationGenera
import io.github.freya022.botcommands.api.commands.application.slash.options.builder.SlashCommandOptionAggregateBuilder
import io.github.freya022.botcommands.api.commands.application.slash.options.builder.SlashCommandOptionBuilder
import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationCommandOptionAggregateBuilderImpl
import io.github.freya022.botcommands.internal.commands.application.options.builder.ApplicationGeneratedOptionBuilderImpl
import io.github.freya022.botcommands.internal.commands.application.slash.builder.SlashCommandBuilderImpl
@@ -12,16 +11,13 @@ import io.github.freya022.botcommands.internal.parameters.AggregatorParameter
import kotlin.reflect.KFunction
internal class SlashCommandOptionAggregateBuilderImpl internal constructor(
- override val context: BContext,
+ private val context: BContext,
private val commandBuilder: SlashCommandBuilderImpl,
aggregatorParameter: AggregatorParameter,
aggregator: KFunction<*>
) : ApplicationCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator),
SlashCommandOptionAggregateBuilder {
- override val declarationSiteHolder: IDeclarationSiteHolder
- get() = commandBuilder
-
override fun option(declaredName: String, optionName: String, block: SlashCommandOptionBuilder.() -> Unit) {
this += SlashCommandOptionBuilderImpl(
context,
@@ -55,4 +51,4 @@ internal class SlashCommandOptionAggregateBuilderImpl internal constructor(
override fun constructNestedAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
SlashCommandOptionAggregateBuilderImpl(context, commandBuilder, aggregatorParameter, aggregator)
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/TextCommandsContextImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/TextCommandsContextImpl.kt
index b805ae516..3fe118b02 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/TextCommandsContextImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/TextCommandsContextImpl.kt
@@ -1,5 +1,3 @@
-@file:Suppress("removal")
-
package io.github.freya022.botcommands.internal.commands.text
import io.github.freya022.botcommands.api.commands.text.HelpBuilderConsumer
@@ -97,4 +95,4 @@ internal class TextCommandsContextImpl internal constructor(
val command = findTextCommand(words) ?: return emptyList()
return command.subcommands.values
}
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/builder/TextCommandVariationBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/builder/TextCommandVariationBuilderImpl.kt
index 92428ba05..2aabf4d56 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/builder/TextCommandVariationBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/builder/TextCommandVariationBuilderImpl.kt
@@ -30,7 +30,7 @@ internal class TextCommandVariationBuilderImpl internal constructor(
private val aggregateContainer =
OptionAggregateBuilderContainerMixinImpl(function) { aggregatorParameter, aggregator ->
- TextCommandOptionAggregateBuilderImpl(context, this, aggregatorParameter, aggregator)
+ TextCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
}
override val optionAggregateBuilders: Map
@@ -99,4 +99,4 @@ internal class TextCommandVariationBuilderImpl internal constructor(
internal fun build(info: TextCommandInfoImpl): TextCommandVariationImpl {
return TextCommandVariationImpl(context, info, this)
}
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/options/builder/TextCommandOptionAggregateBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/options/builder/TextCommandOptionAggregateBuilderImpl.kt
index 9cbea35bd..187b70f48 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/options/builder/TextCommandOptionAggregateBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/commands/text/options/builder/TextCommandOptionAggregateBuilderImpl.kt
@@ -3,16 +3,12 @@ package io.github.freya022.botcommands.internal.commands.text.options.builder
import io.github.freya022.botcommands.api.commands.text.TextGeneratedValueSupplier
import io.github.freya022.botcommands.api.commands.text.options.builder.TextCommandOptionAggregateBuilder
import io.github.freya022.botcommands.api.commands.text.options.builder.TextCommandOptionBuilder
-import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
import io.github.freya022.botcommands.internal.core.options.builder.OptionAggregateBuilderImpl
import io.github.freya022.botcommands.internal.parameters.AggregatorParameter
import io.github.freya022.botcommands.internal.utils.throwArgument
import kotlin.reflect.KFunction
internal class TextCommandOptionAggregateBuilderImpl internal constructor(
- override val context: BContext,
- override val declarationSiteHolder: IDeclarationSiteHolder,
aggregatorParameter: AggregatorParameter,
aggregator: KFunction<*>
) : OptionAggregateBuilderImpl(aggregatorParameter, aggregator),
@@ -50,5 +46,5 @@ internal class TextCommandOptionAggregateBuilderImpl internal constructor(
}
override fun constructNestedAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
- TextCommandOptionAggregateBuilderImpl(context, declarationSiteHolder, aggregatorParameter, aggregator)
-}
\ No newline at end of file
+ TextCommandOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesDefaultMessagesAdapter.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesDefaultMessagesAdapter.kt
deleted file mode 100644
index f7db992be..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesDefaultMessagesAdapter.kt
+++ /dev/null
@@ -1,103 +0,0 @@
-@file:Suppress("removal", "DEPRECATION")
-
-package io.github.freya022.botcommands.internal.core.messages.autoconfigure
-
-import io.github.freya022.botcommands.api.commands.application.slash.options.SlashCommandOption
-import io.github.freya022.botcommands.api.commands.text.TopLevelTextCommandInfo
-import io.github.freya022.botcommands.api.core.messages.BotCommandsMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import net.dv8tion.jda.api.Permission
-import net.dv8tion.jda.api.events.GenericEvent
-import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent
-import net.dv8tion.jda.api.events.interaction.command.GenericCommandInteractionEvent
-import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteractionCreateEvent
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.commands.CommandInteractionPayload
-import net.dv8tion.jda.api.utils.TimeFormat
-import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder
-import net.dv8tion.jda.api.utils.messages.MessageCreateData
-import java.time.Instant
-
-internal class BotCommandsMessagesDefaultMessagesAdapter internal constructor(
- private val defaultMessages: DefaultMessages,
-) : BotCommandsMessages {
-
- override fun uncaughtException(event: GenericEvent): MessageCreateData {
- return defaultMessages.generalErrorMsg.toMessage()
- }
-
- override fun missingUserPermissions(event: GenericEvent, permissions: Set): MessageCreateData {
- return defaultMessages.getUserPermErrorMsg(permissions).toMessage()
- }
-
- override fun missingBotPermissions(event: GenericEvent, permissions: Set): MessageCreateData {
- return defaultMessages.getBotPermErrorMsg(permissions).toMessage()
- }
-
- override fun ownerOnly(event: GenericEvent): MessageCreateData {
- return defaultMessages.ownerOnlyErrorMsg.toMessage()
- }
-
- override fun userRateLimited(event: GenericEvent, deadline: Instant): MessageCreateData {
- return defaultMessages.getUserRateLimitMsg(TimeFormat.RELATIVE.atInstant(deadline)).toMessage()
- }
-
- override fun channelRateLimited(event: GenericEvent, deadline: Instant): MessageCreateData {
- return defaultMessages.getChannelRateLimitMsg(TimeFormat.RELATIVE.atInstant(deadline)).toMessage()
- }
-
- override fun guildRateLimited(event: GenericEvent, deadline: Instant): MessageCreateData {
- return defaultMessages.getGuildRateLimitMsg(TimeFormat.RELATIVE.atInstant(deadline)).toMessage()
- }
-
- override fun applicationCommandsNotAvailable(event: GenericCommandInteractionEvent): MessageCreateData {
- return defaultMessages.applicationCommandsNotAvailableMsg.toMessage()
- }
-
- override fun commandNotFound(event: MessageReceivedEvent, suggestions: Collection): MessageCreateData {
- val suggestionsStr = suggestions.joinToString(separator = "**, **", prefix = "**", postfix = "**") { it.name }
- return defaultMessages.getCommandNotFoundMsg(suggestionsStr).toMessage()
- }
-
- override fun resolverChannelNotFound(event: GenericEvent, channelId: Long): MessageCreateData {
- return defaultMessages.resolverChannelNotFoundMsg.toMessage()
- }
-
- override fun resolverChannelMissingAccess(event: GenericEvent, channelId: Long): MessageCreateData {
- return defaultMessages.getResolverChannelMissingAccessMsg("<#$channelId>").toMessage()
- }
-
- override fun resolverUserNotFound(event: GenericEvent, userId: Long): MessageCreateData {
- return defaultMessages.resolverUserNotFoundMsg.toMessage()
- }
-
- override fun slashCommandUnresolvableOption(event: CommandInteractionPayload, option: SlashCommandOption): MessageCreateData {
- return defaultMessages.getSlashCommandUnresolvableOptionMsg(option.discordName).toMessage()
- }
-
- override fun closedDirectMessages(event: GenericEvent): MessageCreateData {
- return defaultMessages.closedDMErrorMsg.toMessage()
- }
-
- override fun nsfwOnly(event: GenericEvent): MessageCreateData {
- return defaultMessages.nsfwOnlyErrorMsg.toMessage()
- }
-
- override fun componentNotAllowed(event: GenericComponentInteractionCreateEvent): MessageCreateData {
- return defaultMessages.componentNotAllowedErrorMsg.toMessage()
- }
-
- override fun componentExpired(event: GenericComponentInteractionCreateEvent): MessageCreateData {
- return defaultMessages.componentExpiredErrorMsg.toMessage()
- }
-
- override fun modalExpired(event: ModalInteractionEvent): MessageCreateData {
- return defaultMessages.modalExpiredErrorMsg.toMessage()
- }
-
- private fun String.toMessage(): MessageCreateData =
- MessageCreateBuilder()
- .setContent(this)
- .useComponentsV2(false)
- .build()
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryAutoConfiguration.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryAutoConfiguration.kt
index 8dfb17b53..60d59dd56 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryAutoConfiguration.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryAutoConfiguration.kt
@@ -1,23 +1,14 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.internal.core.messages.autoconfigure
-import io.github.classgraph.ClassGraph
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
import io.github.freya022.botcommands.api.core.messages.DefaultBotCommandsMessagesFactory
import io.github.freya022.botcommands.api.core.service.annotations.ConditionalOnMissingService
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.LocalizationService
import io.github.freya022.botcommands.api.localization.PermissionLocalization
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
import io.github.freya022.botcommands.internal.core.service.annotations.InternalAutoConfiguration
import io.github.freya022.botcommands.internal.core.service.annotations.InternalAutoConfigurationBeanService
-import io.github.freya022.botcommands.internal.localization.autoconfigure.FallbackDefaultMessagesFactory
-import io.github.freya022.botcommands.internal.utils.classRef
-import io.github.oshai.kotlinlogging.KotlinLogging
-
-private val logger = KotlinLogging.logger { }
@InternalAutoConfiguration
internal open class BotCommandsMessagesFactoryAutoConfiguration internal constructor() {
@@ -25,18 +16,11 @@ internal open class BotCommandsMessagesFactoryAutoConfiguration internal constru
@InternalAutoConfigurationBeanService
@ConditionalOnMissingService(BotCommandsMessagesFactory::class)
open fun botCommandsMessagesFactory(
- defaultMessagesFactory: DefaultMessagesFactory,
permissionLocalization: PermissionLocalization,
localizationService: LocalizationService,
textCommandLocaleProvider: TextCommandLocaleProvider,
userLocaleProvider: UserLocaleProvider,
): BotCommandsMessagesFactory {
- // Check if the user has a custom factory or if the fallback factory has customized files
- if (defaultMessagesFactory !is FallbackDefaultMessagesFactory || hasCustomDefaultMessages()) {
- logger.warn { "${classRef()} has been deprecated and will be removed in the full release." }
- return BotCommandsMessagesFactoryDefaultMessagesFactoryAdapter(defaultMessagesFactory)
- }
-
return DefaultBotCommandsMessagesFactory(
permissionLocalization,
localizationService,
@@ -44,18 +28,4 @@ internal open class BotCommandsMessagesFactoryAutoConfiguration internal constru
userLocaleProvider
)
}
-
- private fun hasCustomDefaultMessages(): Boolean {
- // The base name is guaranteed to be "DefaultMessages" as it is hardcoded in [[DefaultMessages]]
- return ClassGraph()
- .acceptPathsNonRecursive("bc_localization")
- .scan()
- .use { scan ->
- scan.allResources
- .any {
- val path = it.path
- path.startsWith("bc_localization/DefaultMessages") && !path.startsWith("bc_localization/DefaultMessages-default")
- }
- }
- }
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryDefaultMessagesFactoryAdapter.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryDefaultMessagesFactoryAdapter.kt
deleted file mode 100644
index e6ffb635e..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/messages/autoconfigure/BotCommandsMessagesFactoryDefaultMessagesFactoryAdapter.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-@file:Suppress("removal", "DEPRECATION")
-
-package io.github.freya022.botcommands.internal.core.messages.autoconfigure
-
-import io.github.freya022.botcommands.api.core.messages.BotCommandsMessages
-import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.Interaction
-import java.util.*
-
-internal class BotCommandsMessagesFactoryDefaultMessagesFactoryAdapter internal constructor(
- private val defaultMessagesFactory: DefaultMessagesFactory,
-) : BotCommandsMessagesFactory {
-
- override fun get(locale: Locale): BotCommandsMessages {
- return BotCommandsMessagesDefaultMessagesAdapter(defaultMessagesFactory.get(locale))
- }
-
- override fun get(event: MessageReceivedEvent): BotCommandsMessages {
- return BotCommandsMessagesDefaultMessagesAdapter(defaultMessagesFactory.get(event))
- }
-
- override fun get(event: Interaction): BotCommandsMessages {
- return BotCommandsMessagesDefaultMessagesAdapter(defaultMessagesFactory.get(event))
- }
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/options/builder/OptionAggregateBuilderImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/options/builder/OptionAggregateBuilderImpl.kt
index 02fe9e938..0b6969953 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/options/builder/OptionAggregateBuilderImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/options/builder/OptionAggregateBuilderImpl.kt
@@ -1,16 +1,10 @@
package io.github.freya022.botcommands.internal.core.options.builder
-import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
-import io.github.freya022.botcommands.api.core.objectLogger
import io.github.freya022.botcommands.api.core.options.builder.OptionAggregateBuilder
-import io.github.freya022.botcommands.api.core.utils.getSignature
import io.github.freya022.botcommands.internal.commands.CommandDSL
import io.github.freya022.botcommands.internal.core.options.builder.InternalAggregators.isSpecialAggregator
-import io.github.freya022.botcommands.internal.core.service.canCreateWrappedService
import io.github.freya022.botcommands.internal.parameters.AggregatorParameter
import io.github.freya022.botcommands.internal.utils.ReflectionUtils.reflectReference
-import io.github.freya022.botcommands.internal.utils.ReflectionUtils.resolveBestReference
import io.github.freya022.botcommands.internal.utils.requireAt
import kotlin.reflect.KFunction
@@ -41,9 +35,6 @@ internal abstract class OptionAggregateBuilderImpl
}
}
- protected abstract val context: BContext
- protected abstract val declarationSiteHolder: IDeclarationSiteHolder
-
final override fun hasVararg(): Boolean = aggregateContainer.hasVararg()
final override fun serviceOption(declaredName: String) {
@@ -51,10 +42,6 @@ internal abstract class OptionAggregateBuilderImpl
}
final override fun customOption(declaredName: String) {
- if (context.serviceContainer.canCreateWrappedService(aggregatorParameter.typeCheckingParameter) == null) {
- objectLogger().warn { "Using ${this::customOption.resolveBestReference().getSignature(source = false)} **for services** has been deprecated, please use ${this::serviceOption.resolveBestReference().getSignature(source = false)} instead, parameter '$declaredName' of ${declarationSiteHolder.declarationSite}" }
- return serviceOption(declaredName)
- }
this += CustomOptionBuilderImpl(aggregatorParameter.toOptionParameter(aggregator, declaredName))
}
@@ -72,4 +59,4 @@ internal abstract class OptionAggregateBuilderImpl
internal operator fun plusAssign(optionBuilder: OptionBuilderImpl) {
_optionBuilders.computeIfAbsent(optionBuilder.optionParameter.typeCheckingParameterName) { arrayListOf() }.add(optionBuilder)
}
-}
\ No newline at end of file
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/service/BCServiceContainerImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/service/BCServiceContainerImpl.kt
index 62a431927..1f85d1110 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/service/BCServiceContainerImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/service/BCServiceContainerImpl.kt
@@ -1,5 +1,3 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.internal.core.service
import io.github.freya022.botcommands.api.core.config.BServiceConfig
@@ -31,8 +29,7 @@ private val logger = KotlinLogging.loggerOf()
internal class BCServiceContainerImpl internal constructor(
internal val serviceBootstrap: BCBotCommandsBootstrap
-) : BCServiceContainer,
- DefaultServiceContainer {
+) : BCServiceContainer {
internal val serviceConfig: BServiceConfig get() = serviceBootstrap.serviceConfig
internal val serviceProviders: ServiceProviders get() = serviceBootstrap.serviceProviders
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/waiter/EventWaiterImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/waiter/EventWaiterImpl.kt
index 25082c93e..14887a20b 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/waiter/EventWaiterImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/core/waiter/EventWaiterImpl.kt
@@ -130,8 +130,7 @@ internal class EventWaiterImpl(context: BContextImpl) : EventWaiter {
}
}
- @Suppress("DEPRECATION")
- private val warnedEventTypes: MutableSet> = context.config.ignoredEventIntents.toMutableSet()
+ private val warnedEventTypes: MutableSet> = hashSetOf()
private fun checkEventIntents(eventType: Class) {
val requiredIntents = GatewayIntent.fromEvents(eventType)
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/LocalizationContextImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/LocalizationContextImpl.kt
index 57925413f..f691b4254 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/LocalizationContextImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/LocalizationContextImpl.kt
@@ -7,7 +7,6 @@ import io.github.freya022.botcommands.api.localization.context.TextLocalizationC
import io.github.freya022.botcommands.internal.utils.LocalizationUtils
import io.github.freya022.botcommands.internal.utils.throwArgument
import io.github.freya022.botcommands.internal.utils.throwInternal
-import net.dv8tion.jda.api.interactions.DiscordLocale
import java.util.*
internal class LocalizationContextImpl(
@@ -43,18 +42,10 @@ internal class LocalizationContextImpl(
}
}
- @Deprecated("Use the Locale overload")
- override fun withGuildLocale(guildLocale: DiscordLocale?): LocalizationContextImpl =
- withGuildLocale(guildLocale?.toLocale())
-
override fun withGuildLocale(guildLocale: Locale?): LocalizationContextImpl {
return LocalizationContextImpl(localizationService, localizationBundle, localizationPrefix, guildLocale?.toProvider(), _userLocaleProvider)
}
- @Deprecated("Use the Locale overload")
- override fun withUserLocale(userLocale: DiscordLocale?): LocalizationContextImpl =
- withUserLocale(userLocale?.toLocale())
-
override fun withUserLocale(userLocale: Locale?): LocalizationContextImpl {
return LocalizationContextImpl(localizationService, localizationBundle, localizationPrefix, _guildLocaleProvider, userLocale?.toProvider())
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/DefaultMessagesFactoryAutoConfiguration.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/DefaultMessagesFactoryAutoConfiguration.kt
deleted file mode 100644
index 04292812b..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/DefaultMessagesFactoryAutoConfiguration.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-@file:Suppress("removal", "DEPRECATION")
-
-package io.github.freya022.botcommands.internal.localization.autoconfigure
-
-import io.github.freya022.botcommands.api.core.service.annotations.ConditionalOnMissingService
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
-import io.github.freya022.botcommands.api.localization.LocalizationService
-import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
-import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
-import io.github.freya022.botcommands.internal.core.service.annotations.InternalAutoConfiguration
-import io.github.freya022.botcommands.internal.core.service.annotations.InternalAutoConfigurationBeanService
-
-@InternalAutoConfiguration
-internal open class DefaultMessagesFactoryAutoConfiguration {
-
- @InternalAutoConfigurationBeanService
- @ConditionalOnMissingService(DefaultMessagesFactory::class)
- open fun defaultMessagesFactory(
- localizationService: LocalizationService,
- textCommandLocaleProvider: TextCommandLocaleProvider,
- userLocaleProvider: UserLocaleProvider,
- ): DefaultMessagesFactory {
- return FallbackDefaultMessagesFactory(localizationService, textCommandLocaleProvider, userLocaleProvider)
- }
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/FallbackDefaultMessagesFactory.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/FallbackDefaultMessagesFactory.kt
deleted file mode 100644
index 692b911ae..000000000
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/autoconfigure/FallbackDefaultMessagesFactory.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-@file:Suppress("removal", "DEPRECATION")
-
-package io.github.freya022.botcommands.internal.localization.autoconfigure
-
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
-import io.github.freya022.botcommands.api.localization.LocalizationService
-import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
-import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.Interaction
-import java.util.*
-
-internal class FallbackDefaultMessagesFactory internal constructor(
- private val localizationService: LocalizationService,
- private val textCommandLocaleProvider: TextCommandLocaleProvider,
- private val userLocaleProvider: UserLocaleProvider,
-): DefaultMessagesFactory {
- private val cache: MutableMap = hashMapOf()
-
- override fun get(locale: Locale): DefaultMessages = cache.computeIfAbsent(locale) {
- DefaultMessages(localizationService, it)
- }
-
- override fun get(event: MessageReceivedEvent): DefaultMessages {
- return get(textCommandLocaleProvider.getLocale(event))
- }
-
- override fun get(event: Interaction): DefaultMessages {
- return get(userLocaleProvider.getLocale(event))
- }
-}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionFactory.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionFactory.kt
index 9c51765ce..6b4d4481e 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionFactory.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionFactory.kt
@@ -1,11 +1,8 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.internal.localization.interaction
import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
import io.github.freya022.botcommands.api.core.service.annotations.BService
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.LocalizationService
import io.github.freya022.botcommands.api.localization.interaction.GuildLocaleProvider
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
@@ -18,9 +15,8 @@ internal class LocalizableInteractionFactory internal constructor(
private val localizationConfig: BLocalizationConfig,
private val userLocaleProvider: UserLocaleProvider,
private val guildLocaleProvider: GuildLocaleProvider,
- private val defaultMessagesFactory: DefaultMessagesFactory,
private val messagesFactory: BotCommandsMessagesFactory,
) {
internal fun create(event: IReplyCallback) =
- LocalizableInteractionImpl(event, localizationService, localizationConfig, userLocaleProvider, guildLocaleProvider, defaultMessagesFactory, messagesFactory)
-}
\ No newline at end of file
+ LocalizableInteractionImpl(event, localizationService, localizationConfig, userLocaleProvider, guildLocaleProvider, messagesFactory)
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionImpl.kt
index 6cc43def2..0167d6158 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/LocalizableInteractionImpl.kt
@@ -1,12 +1,8 @@
-@file:Suppress("removal", "DEPRECATION")
-
package io.github.freya022.botcommands.internal.localization.interaction
import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessages
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.LocalizationService
import io.github.freya022.botcommands.api.localization.context.AppLocalizationContext
@@ -25,7 +21,6 @@ internal class LocalizableInteractionImpl internal constructor(
localizationConfig: BLocalizationConfig,
private val userLocaleProvider: UserLocaleProvider,
private val guildLocaleProvider: GuildLocaleProvider,
- private val defaultMessagesFactory: DefaultMessagesFactory,
private val messagesFactory: BotCommandsMessagesFactory,
) : AbstractLocalizableAction(localizationConfig, localizationService),
LocalizableInteraction {
@@ -41,12 +36,6 @@ internal class LocalizableInteractionImpl internal constructor(
.build()
}
- @Suppress("DEPRECATION", "removal")
- @Deprecated("Replaced with getBotCommandsMessages()")
- override fun getDefaultMessages(): DefaultMessages {
- return defaultMessagesFactory.get(deferrableCallback)
- }
-
override fun getBotCommandsMessages(): BotCommandsMessages {
return messagesFactory.get(deferrableCallback)
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultGuildLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultGuildLocaleProvider.kt
index 9f1b71384..cc6d3f6ab 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultGuildLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultGuildLocaleProvider.kt
@@ -1,14 +1,10 @@
package io.github.freya022.botcommands.internal.localization.interaction.autoconfigure
import io.github.freya022.botcommands.api.localization.interaction.GuildLocaleProvider
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
internal object DefaultGuildLocaleProvider : GuildLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- override fun getDiscordLocale(interaction: Interaction): DiscordLocale = interaction.guildLocale
-
override fun getLocale(interaction: Interaction): Locale = interaction.guildLocale.toLocale()
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultUserLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultUserLocaleProvider.kt
index df0c52566..dec44ab62 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultUserLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/interaction/autoconfigure/DefaultUserLocaleProvider.kt
@@ -1,14 +1,10 @@
package io.github.freya022.botcommands.internal.localization.interaction.autoconfigure
import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider
-import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.interactions.Interaction
import java.util.*
internal object DefaultUserLocaleProvider : UserLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- override fun getDiscordLocale(interaction: Interaction): DiscordLocale = interaction.userLocale
-
override fun getLocale(interaction: Interaction): Locale = interaction.userLocale.toLocale()
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandFactory.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandFactory.kt
index a75a5aadd..b22ec93d6 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandFactory.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandFactory.kt
@@ -1,11 +1,8 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.internal.localization.text
import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
import io.github.freya022.botcommands.api.core.service.annotations.BService
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.LocalizationService
import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
@@ -16,9 +13,8 @@ internal class LocalizableTextCommandFactory internal constructor(
private val localizationService: LocalizationService,
private val localizationConfig: BLocalizationConfig,
private val localeProvider: TextCommandLocaleProvider,
- private val defaultMessagesFactory: DefaultMessagesFactory,
private val messagesFactory: BotCommandsMessagesFactory,
) {
internal fun create(event: MessageReceivedEvent) =
- LocalizableTextCommandImpl(event, localizationService, localizationConfig, localeProvider, defaultMessagesFactory, messagesFactory)
-}
\ No newline at end of file
+ LocalizableTextCommandImpl(event, localizationService, localizationConfig, localeProvider, messagesFactory)
+}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandImpl.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandImpl.kt
index ee660c419..5b9c5a000 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandImpl.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/LocalizableTextCommandImpl.kt
@@ -1,12 +1,8 @@
-@file:Suppress("removal", "DEPRECATION")
-
package io.github.freya022.botcommands.internal.localization.text
import io.github.freya022.botcommands.api.core.config.BLocalizationConfig
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessages
import io.github.freya022.botcommands.api.core.messages.BotCommandsMessagesFactory
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.api.localization.Localization
import io.github.freya022.botcommands.api.localization.LocalizationService
import io.github.freya022.botcommands.api.localization.context.LocalizationContext
@@ -23,7 +19,6 @@ internal class LocalizableTextCommandImpl internal constructor(
localizationService: LocalizationService,
localizationConfig: BLocalizationConfig,
private val localeProvider: TextCommandLocaleProvider,
- private val defaultMessagesFactory: DefaultMessagesFactory,
private val messagesFactory: BotCommandsMessagesFactory,
) : AbstractLocalizableAction(localizationConfig, localizationService), LocalizableTextCommand {
private val locale: Locale by lazy { localeProvider.getLocale(event) }
@@ -35,12 +30,6 @@ internal class LocalizableTextCommandImpl internal constructor(
.build()
}
- @Suppress("DEPRECATION", "removal")
- @Deprecated("Replaced with getBotCommandsMessages()")
- override fun getDefaultMessages(): DefaultMessages {
- return defaultMessagesFactory.get(locale)
- }
-
override fun getBotCommandsMessages(): BotCommandsMessages {
return messagesFactory.get(locale)
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/autoconfigure/DefaultTextCommandLocaleProvider.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/autoconfigure/DefaultTextCommandLocaleProvider.kt
index 7ea2ad142..862f63038 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/autoconfigure/DefaultTextCommandLocaleProvider.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/localization/text/autoconfigure/DefaultTextCommandLocaleProvider.kt
@@ -2,13 +2,9 @@ package io.github.freya022.botcommands.internal.localization.text.autoconfigure
import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider
import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.DiscordLocale
import java.util.*
internal object DefaultTextCommandLocaleProvider : TextCommandLocaleProvider {
- @Deprecated("Use 'getLocale' instead, use 'DiscordLocale.from' / 'DiscordLocale#toLocale' if necessary")
- override fun getDiscordLocale(event: MessageReceivedEvent): DiscordLocale = event.guild.locale
-
override fun getLocale(event: MessageReceivedEvent): Locale = event.guild.locale.toLocale()
}
diff --git a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/options/MethodParameters.kt b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/options/MethodParameters.kt
index d0383068a..8628e8083 100644
--- a/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/options/MethodParameters.kt
+++ b/BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/internal/options/MethodParameters.kt
@@ -1,7 +1,5 @@
package io.github.freya022.botcommands.internal.options
-import io.github.freya022.botcommands.api.core.BContext
-import io.github.freya022.botcommands.api.core.IDeclarationSiteHolder
import io.github.freya022.botcommands.api.core.options.annotations.Aggregate
import io.github.freya022.botcommands.api.core.options.builder.OptionAggregateBuilder
import io.github.freya022.botcommands.api.core.utils.hasAnnotationRecursive
@@ -15,7 +13,6 @@ import io.github.freya022.botcommands.internal.utils.ReflectionUtils.function
import io.github.freya022.botcommands.internal.utils.ReflectionUtils.nonInstanceParameters
import io.github.freya022.botcommands.internal.utils.findDeclarationName
import io.github.freya022.botcommands.internal.utils.throwArgument
-import io.github.freya022.botcommands.internal.utils.throwInternal
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
import kotlin.reflect.full.primaryConstructor
@@ -25,11 +22,6 @@ private class BasicOptionAggregateBuilderImpl(
aggregatorParameter: AggregatorParameter,
aggregator: KFunction<*>
) : OptionAggregateBuilderImpl(aggregatorParameter, aggregator) {
- override val context: BContext
- get() = throwInternal("Internal aggregate builder should not be used outside of the += operator")
-
- override val declarationSiteHolder: IDeclarationSiteHolder
- get() = throwInternal("Internal aggregate builder should not be used outside of the += operator")
override fun constructNestedAggregate(aggregatorParameter: AggregatorParameter, aggregator: KFunction<*>) =
BasicOptionAggregateBuilderImpl(aggregatorParameter, aggregator)
@@ -61,4 +53,4 @@ internal fun Function<*>.transformParameters(
this += builderBlock(parameter.function, parameter, declaredName)
}
}
-}.transform(aggregateBlock)
\ No newline at end of file
+}.transform(aggregateBlock)
diff --git a/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/messages/BotCommandsMessagesTests.kt b/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/messages/BotCommandsMessagesTests.kt
index 812ef5b9b..08987b890 100644
--- a/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/messages/BotCommandsMessagesTests.kt
+++ b/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/messages/BotCommandsMessagesTests.kt
@@ -1,5 +1,3 @@
-@file:Suppress("DEPRECATION", "removal")
-
package io.github.freya022.botcommands.messages
import dev.freya02.botcommands.helpers.AbstractIntegrationTest
@@ -10,61 +8,19 @@ import io.github.freya022.botcommands.api.core.messages.DefaultBotCommandsMessag
import io.github.freya022.botcommands.api.core.messages.exceptions.MissingMessageTemplateException
import io.github.freya022.botcommands.api.core.service.getService
import io.github.freya022.botcommands.api.core.utils.joinAsList
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
-import io.github.freya022.botcommands.internal.core.messages.autoconfigure.BotCommandsMessagesFactoryAutoConfiguration
import io.mockk.every
import io.mockk.mockk
import io.mockk.slot
import io.mockk.spyk
-import net.dv8tion.jda.api.events.message.MessageReceivedEvent
-import net.dv8tion.jda.api.interactions.Interaction
import net.dv8tion.jda.api.utils.messages.MessageCreateData
import java.time.Instant
import java.util.*
import kotlin.reflect.KFunction
import kotlin.test.Test
-import kotlin.test.assertIsNot
import kotlin.test.fail
class BotCommandsMessagesTests : AbstractIntegrationTest() {
- @Test
- fun `Adapter is used when custom DefaultMessagesFactory type is used`() {
- val context = createTest {
- services {
- registerServiceSupplier {
- object : DefaultMessagesFactory {
- override fun get(locale: Locale): DefaultMessages = throw UnsupportedOperationException()
- override fun get(event: MessageReceivedEvent) = throw UnsupportedOperationException()
- override fun get(event: Interaction) = throw UnsupportedOperationException()
- }
- }
- }
- }
-
- assertIsNot(context.getService())
- }
-
- @Test
- fun `Adapter is used when custom DefaultMessages JSON exists`() {
- val context = createTest {
- services {
- registerServiceSupplier {
- mockk {
- every {
- botCommandsMessagesFactory(any(), any(), any(), any(), any())
- } answers { callOriginal() }
-
- every { this@mockk["hasCustomDefaultMessages"]() } returns true
- }
- }
- }
- }
-
- assertIsNot(context.getService())
- }
-
@Test
fun `All messages have defaults`() {
val context = createTest {
diff --git a/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/othertests/FunctionTypeTest.kt b/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/othertests/FunctionTypeTest.kt
index f419b29b7..514441a3c 100644
--- a/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/othertests/FunctionTypeTest.kt
+++ b/BotCommands-core/src/test/kotlin/io/github/freya022/botcommands/othertests/FunctionTypeTest.kt
@@ -1,5 +1,3 @@
-@file:Suppress("OVERRIDE_DEPRECATION", "DEPRECATION")
-
package io.github.freya022.botcommands.othertests
import io.github.freya022.botcommands.api.components.ComponentInteractionFilter
@@ -93,4 +91,3 @@ object FunctionTypeTest {
}
}
}
-
diff --git a/BotCommands-jda-ktx/build.gradle.kts b/BotCommands-jda-ktx/build.gradle.kts
index b943cc508..4746cd3f4 100644
--- a/BotCommands-jda-ktx/build.gradle.kts
+++ b/BotCommands-jda-ktx/build.gradle.kts
@@ -5,8 +5,6 @@ plugins {
id("kotlin-conventions")
id("publish-conventions")
id("dokka-conventions")
-
- alias(libs.plugins.ksp)
}
dependencies {
@@ -15,8 +13,6 @@ dependencies {
compileOnly(libs.jda)
api(libs.kotlinx.coroutines.core)
- ksp(projects.jdaKtxDeprecationProcessor)
-
// -------------------- TEST DEPENDENCIES --------------------
testImplementation(libs.bundles.test)
@@ -29,8 +25,6 @@ dependencies {
tasks.named("test") {
useJUnitPlatform()
-
- environment("KSP_OUTPUT", layout.buildDirectory.dir("generated/ksp").get().asFile.path)
}
publishedProjectEnvironment {
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Channels.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Channels.kt
index 3387bf4b3..2174ce73c 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Channels.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Channels.kt
@@ -6,17 +6,14 @@ import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
/**
* Same as [IGuildChannelContainer.getChannelById] but with a reified type parameter.
*/
-@ReplaceJdaKtx
inline fun IGuildChannelContainer.getChannel(id: Long): T? = getChannelById(T::class.java, id)
/**
* Same as [IGuildChannelContainer.getChannelById] but with a reified type parameter.
*/
-@ReplaceJdaKtx
inline fun IGuildChannelContainer.getChannel(id: String): T? = getChannelById(T::class.java, id)
/**
* Same as [IGuildChannelContainer.getChannelById] but with a reified type parameter.
*/
-@ReplaceJdaKtx
inline fun IGuildChannelContainer.getChannel(id: ULong): T? = getChannel(id.toLong())
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/DeprecatedInBcCore.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/DeprecatedInBcCore.kt
deleted file mode 100644
index a816388b9..000000000
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/DeprecatedInBcCore.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package dev.freya02.botcommands.jda.ktx
-
-@Retention(AnnotationRetention.SOURCE)
-internal annotation class DeprecatedInBcCore
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Files.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Files.kt
index 78c3b0998..d1f26d05a 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Files.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Files.kt
@@ -2,5 +2,4 @@ package dev.freya02.botcommands.jda.ktx
import net.dv8tion.jda.api.utils.FileUpload
-@ReplaceJdaKtx("dev.minn.jda.ktx.messages")
fun FileUpload.into() = listOf(this)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Mentions.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Mentions.kt
index eea603d9f..c527ead0f 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Mentions.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/Mentions.kt
@@ -7,7 +7,6 @@ import org.apache.commons.collections4.Bag
/**
* Same as [Mentions.getChannels] but with a reified type parameter.
*/
-@ReplaceJdaKtx
@Suppress("EXTENSION_SHADOWED_BY_MEMBER")
inline fun Mentions.getChannels(): List {
return getChannels(T::class.java)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ReplaceJdaKtx.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ReplaceJdaKtx.kt
deleted file mode 100644
index e7eb8df8f..000000000
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ReplaceJdaKtx.kt
+++ /dev/null
@@ -1,4 +0,0 @@
-package dev.freya02.botcommands.jda.ktx
-
-@Retention(AnnotationRetention.SOURCE)
-internal annotation class ReplaceJdaKtx(val pkg: String = "")
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/ActionRow.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/ActionRow.kt
index 944a9e952..931aa9770 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/ActionRow.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/ActionRow.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.components
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import net.dv8tion.jda.api.components.actionrow.ActionRow
import net.dv8tion.jda.api.components.actionrow.ActionRowChildComponent
import net.dv8tion.jda.api.components.buttons.Button
@@ -50,21 +49,16 @@ inline fun ActionRow(uniqueId: Int = -1, block: InlineActionRow.() -> Unit): Act
/**
* Construct an [ActionRow] from the provided components
*/
-@ReplaceJdaKtx
fun row(component: ActionRowChildComponent, vararg components: ActionRowChildComponent) = ActionRow.of(component, *components)
/**
* Construct an [ActionRow] from the provided components
*/
-@ReplaceJdaKtx
fun Collection.row() = ActionRow.of(this)
-@ReplaceJdaKtx("dev.minn.jda.ktx.messages")
@JvmName("intoComponents")
fun Collection.into(): List = listOf(this.row())
-@ReplaceJdaKtx("dev.minn.jda.ktx.messages")
fun ActionRowChildComponent.into(): List = row(this).into()
-@ReplaceJdaKtx("dev.minn.jda.ktx.messages")
fun T.into(): List = listOf(this)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/IDisableable.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/IDisableable.kt
index 08ad09e61..49cb8d6b5 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/IDisableable.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/IDisableable.kt
@@ -1,13 +1,11 @@
package dev.freya02.botcommands.jda.ktx.components
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import net.dv8tion.jda.api.components.Component
import net.dv8tion.jda.api.components.tree.ComponentTree
/**
* Returns a list containing the results of disabling/enabling each component in the original collection.
*/
-@ReplaceJdaKtx
@Suppress("UNCHECKED_CAST")
fun Iterable.withDisabled(disabled: Boolean): List =
ComponentTree.of(this.toList()).withDisabled(disabled).components as List
@@ -15,13 +13,11 @@ fun Iterable.withDisabled(disabled: Boolean): List =
/**
* Returns a list containing the results of disabling each component in the original collection.
*/
-@ReplaceJdaKtx
fun Iterable.asDisabled() = withDisabled(true)
/**
* Returns a list containing the results of enabling each component in the original collection.
*/
-@ReplaceJdaKtx
fun Iterable.asEnabled() = withDisabled(false)
/**
@@ -29,7 +25,6 @@ fun Iterable.asEnabled() = withDisabled(false)
*
* The operation is _intermediate_ and _stateless_.
*/
-@ReplaceJdaKtx
fun Sequence.withDisabled(disabled: Boolean) =
asIterable().withDisabled(disabled).asSequence()
@@ -38,7 +33,6 @@ fun Sequence.withDisabled(disabled: Boolean) =
*
* The operation is _intermediate_ and _stateless_.
*/
-@ReplaceJdaKtx
fun Sequence.asDisabled() = withDisabled(true)
/**
@@ -46,5 +40,4 @@ fun Sequence.asDisabled() = withDisabled(true)
*
* The operation is _intermediate_ and _stateless_.
*/
-@ReplaceJdaKtx
fun Sequence.asEnabled() = withDisabled(false)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/SelectMenus.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/SelectMenus.kt
index e50705197..8b4211617 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/SelectMenus.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/components/SelectMenus.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.components
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import net.dv8tion.jda.api.components.selections.SelectOption
import net.dv8tion.jda.api.components.selections.StringSelectMenu
import net.dv8tion.jda.api.entities.emoji.Emoji
@@ -14,7 +13,6 @@ import net.dv8tion.jda.api.entities.emoji.Emoji
* @param emoji The emoji of this option
* @param default Whether this option is selected by default
*/
-@ReplaceJdaKtx
fun SelectOption(
label: String,
value: String,
@@ -35,7 +33,6 @@ fun SelectOption(
* @param emoji The emoji of this option
* @param default Whether this option is selected by default
*/
-@ReplaceJdaKtx("dev.minn.jda.ktx.interactions.components")
fun StringSelectMenu.Builder.option(
label: String,
value: String,
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/coroutines/Coroutines.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/coroutines/Coroutines.kt
index f02526870..d69ddd48b 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/coroutines/Coroutines.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/coroutines/Coroutines.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.coroutines
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.future.await
@@ -14,13 +13,11 @@ import kotlin.coroutines.resumeWithException
/**
* Suspends until the REST request is finished and returns the result.
*/
-@ReplaceJdaKtx("dev.minn.jda.ktx.coroutines")
suspend fun RestAction.await(): T = submit(true).await()
/**
* Suspends until the gateway request is finished and returns the result.
*/
-@ReplaceJdaKtx("dev.minn.jda.ktx.coroutines")
suspend fun Task.await(): T = suspendCancellableCoroutine { cont ->
cont.invokeOnCancellation { cancel() }
onSuccess { r -> cont.resume(r) }
@@ -30,7 +27,6 @@ suspend fun Task.await(): T = suspendCancellableCoroutine { cont ->
/**
* Converts the pagination action to a [Flow].
*/
-@ReplaceJdaKtx
fun PaginationAction.asFlow(): Flow = flow {
cache(false)
var elements: List = await()
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/durations/Durations.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/durations/Durations.kt
index cbb9d061a..67ee8aa7e 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/durations/Durations.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/durations/Durations.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.durations
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.JDA
import net.dv8tion.jda.api.entities.BulkBanResponse
import net.dv8tion.jda.api.entities.Guild
@@ -25,21 +24,18 @@ import kotlin.time.toJavaDuration
/**
* @see RestAction.delay
*/
-@DeprecatedInBcCore
fun RestAction.delay(duration: Duration): RestAction =
delay(duration.toJavaDuration())
/**
* @see RestAction.delay
*/
-@DeprecatedInBcCore
fun RestAction.delay(duration: Duration, scheduler: ScheduledExecutorService): RestAction =
delay(duration.toJavaDuration(), scheduler)
/**
* @see RestAction.timeout
*/
-@DeprecatedInBcCore
@Suppress("UNCHECKED_CAST")
fun > T.timeout(duration: Duration): T =
timeout(duration.inWholeMilliseconds, TimeUnit.MILLISECONDS) as T
@@ -47,72 +43,60 @@ fun > T.timeout(duration: Duration): T =
/**
* @see JDA.awaitShutdown
*/
-@DeprecatedInBcCore
fun JDA.awaitShutdown(timeout: Duration): Boolean = awaitShutdown(timeout.toJavaDuration())
/**
* @see Guild.timeoutFor
*/
-@DeprecatedInBcCore
fun Guild.timeoutFor(user: UserSnowflake, duration: Duration): AuditableRestAction = timeoutFor(user, duration.toJavaDuration())
/**
* @see Member.timeoutFor
*/
-@DeprecatedInBcCore
fun Member.timeoutFor(duration: Duration): AuditableRestAction = timeoutFor(duration.toJavaDuration())
/**
* @see Member.ban
*/
-@DeprecatedInBcCore
fun Member.ban(deletionTimeframe: Duration): AuditableRestAction =
ban(deletionTimeframe.inWholeSeconds.toInt(), TimeUnit.SECONDS)
/**
* @see Guild.ban
*/
-@DeprecatedInBcCore
fun Guild.ban(user: UserSnowflake, deletionTimeframe: Duration): AuditableRestAction =
ban(user, deletionTimeframe.inWholeSeconds.toInt(), TimeUnit.SECONDS)
/**
* See [bulk ban from JDA](https://docs.jda.wiki/net/dv8tion/jda/api/entities/Guild.html#ban(java.util.Collection,java.time.Duration))
*/
-@DeprecatedInBcCore
fun Guild.ban(users: Collection, duration: Duration): AuditableRestAction =
ban(users, duration.toJavaDuration())
/**
* @see TimeFormat.after
*/
-@DeprecatedInBcCore
fun TimeFormat.after(duration: Duration): Timestamp = after(duration.toJavaDuration())
/**
* @see TimeFormat.before
*/
-@DeprecatedInBcCore
fun TimeFormat.before(duration: Duration): Timestamp = before(duration.toJavaDuration())
/**
* @see Timestamp.plus
*/
-@DeprecatedInBcCore
operator fun Timestamp.plus(duration: Duration): Timestamp = plus(duration.toJavaDuration())
/**
* @see Timestamp.minus
*/
-@DeprecatedInBcCore
operator fun Timestamp.minus(duration: Duration): Timestamp = minus(duration.toJavaDuration())
/**
* @see Task.setTimeout
*/
-@DeprecatedInBcCore
fun Task.setTimeout(duration: Duration): Task = setTimeout(duration.toJavaDuration())
/**
* @see GatewayTask.setTimeout
*/
-@DeprecatedInBcCore
fun GatewayTask.setTimeout(duration: Duration): Task = setTimeout(duration.toJavaDuration())
/**
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ContentIntent.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ContentIntent.kt
index 15eba33c7..b82d78044 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ContentIntent.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ContentIntent.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.internal.entities.ReceivedMessage
/**
@@ -8,7 +7,6 @@ import net.dv8tion.jda.internal.entities.ReceivedMessage
*
* **Note:** This applies to all threads while the current code is inside this function
*/
-@DeprecatedInBcCore
inline fun suppressContentWarning(block: () -> R): R {
val oldFlag = ReceivedMessage.didContentIntentWarning
ReceivedMessage.didContentIntentWarning = true
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Converters.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Converters.kt
index 79714a8b3..795b975b0 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Converters.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Converters.kt
@@ -1,19 +1,16 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.utils.messages.MessageCreateData
import net.dv8tion.jda.api.utils.messages.MessageEditData
/**
* @see MessageEditData.fromCreateData
*/
-@DeprecatedInBcCore
fun MessageCreateData.toEditData(): MessageEditData =
MessageEditData.fromCreateData(this)
/**
* @see MessageCreateData.fromEditData
*/
-@DeprecatedInBcCore
fun MessageEditData.toCreateData(): MessageCreateData =
MessageCreateData.fromEditData(this)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Deletes.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Deletes.kt
index 3c8080e8d..48463ab82 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Deletes.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Deletes.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import dev.freya02.botcommands.jda.ktx.durations.delay
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.interactions.InteractionHook
@@ -12,7 +11,6 @@ import kotlin.time.Duration
*
* **Note:** This delays the rest action by the given delay.
*/
-@DeprecatedInBcCore
fun RestAction.deleteDelayed(hook: InteractionHook, delay: Duration?): RestAction {
return withFiniteDelayOrSelf(delay) { finiteDelay ->
delay(finiteDelay).flatMapOriginal { hook.deleteOriginal() }
@@ -24,7 +22,6 @@ fun RestAction.deleteDelayed(hook: InteractionHook, delay: Duration?): Re
*
* **Note:** This delays the rest action by the given delay.
*/
-@DeprecatedInBcCore
fun RestAction.deleteDelayed(delay: Duration?): RestAction {
return withFiniteDelayOrSelf(delay) { finiteDelay ->
delay(finiteDelay).flatMapOriginal(InteractionHook::deleteOriginal)
@@ -36,7 +33,6 @@ fun RestAction.deleteDelayed(delay: Duration?): RestAction.deleteDelayed(delay: Duration?): RestAction {
return withFiniteDelayOrSelf(delay) { finiteDelay ->
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Editing.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Editing.kt
index 5a9ee2707..6c79917e6 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Editing.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Editing.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import net.dv8tion.jda.api.components.MessageTopLevelComponent
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.MessageEmbed
@@ -25,7 +24,6 @@ import net.dv8tion.jda.api.utils.messages.MessageRequest
*
* @see IMessageEditCallback.editMessage
*/
-@ReplaceJdaKtx
@Suppress("FunctionName") // To facilitate imports
inline fun IMessageEditCallback.editMessage_(
content: String? = null,
@@ -50,7 +48,6 @@ inline fun IMessageEditCallback.editMessage_(
*
* @see InteractionHook.editMessageById
*/
-@ReplaceJdaKtx
inline fun InteractionHook.editMessage(
id: String = "@original",
content: String? = null,
@@ -75,7 +72,6 @@ inline fun InteractionHook.editMessage(
*
* @see MessageChannel.editMessageById
*/
-@ReplaceJdaKtx
inline fun MessageChannel.editMessage(
id: String,
content: String? = null,
@@ -99,7 +95,6 @@ inline fun MessageChannel.editMessage(
*
* @see Message.editMessage
*/
-@ReplaceJdaKtx
inline fun Message.edit(
content: String? = null,
embeds: Collection? = null,
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/EditingTo.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/EditingTo.kt
index 6922e6596..7fa3b1b28 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/EditingTo.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/EditingTo.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
import net.dv8tion.jda.api.interactions.InteractionHook
@@ -13,20 +12,17 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData
/**
* @see IMessageEditCallback.editMessage
*/
-@DeprecatedInBcCore
fun MessageEditData.edit(callback: IMessageEditCallback): MessageEditCallbackAction =
callback.editMessage(this)
/**
* @see InteractionHook.editOriginal
*/
-@DeprecatedInBcCore
fun MessageEditData.edit(hook: InteractionHook): WebhookMessageEditAction =
hook.editOriginal(this)
/**
* @see MessageChannel.editMessageById
*/
-@DeprecatedInBcCore
fun MessageEditData.edit(channel: MessageChannel, id: Long): MessageEditAction =
channel.editMessageById(id, this)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Messages.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Messages.kt
index 921568b0f..bd118f2b7 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Messages.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Messages.kt
@@ -2,7 +2,6 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import dev.freya02.botcommands.jda.ktx.components.*
import dev.freya02.botcommands.jda.ktx.hex
import dev.freya02.botcommands.jda.ktx.hsb
@@ -42,7 +41,6 @@ typealias InlineMessageEdit = InlineMessage
@PublishedApi
internal val NO_CONTENT = emptyList()
-@ReplaceJdaKtx
inline fun MessageCreateBuilder(
content: String? = null,
embeds: Collection = NO_CONTENT,
@@ -69,7 +67,6 @@ inline fun MessageCreateBuilder(
InlineMessage(this).apply(builder)
}
-@ReplaceJdaKtx
inline fun MessageCreate(
content: String? = null,
embeds: Collection = NO_CONTENT,
@@ -103,7 +100,6 @@ inline fun MessageCreate(
* @param replace `true` to replace the entire message, `false` to only replace specified parts
* @param builder Additional configuration, can override the previously provided parameters
*/
-@ReplaceJdaKtx
inline fun MessageEditBuilder(
content: String? = null,
embeds: Collection? = null,
@@ -135,7 +131,6 @@ inline fun MessageEditBuilder(
* @param replace `true` to replace the entire message, `false` to only replace specified parts
* @param builder Additional configuration, can override the previously provided parameters
*/
-@ReplaceJdaKtx
inline fun MessageEdit(
content: String? = null,
embeds: Collection? = null,
@@ -156,7 +151,6 @@ inline fun MessageEdit(
builder
).build()
-@ReplaceJdaKtx
inline fun Embed(
color: Int? = null,
timestamp: TemporalAccessor? = null,
@@ -165,7 +159,6 @@ inline fun Embed(
return EmbedBuilder(color, timestamp, builder).build()
}
-@ReplaceJdaKtx
inline fun EmbedBuilder(
color: Int? = null,
timestamp: TemporalAccessor? = null,
@@ -178,7 +171,6 @@ inline fun EmbedBuilder(
InlineEmbed(this).apply(builder)
}
-@ReplaceJdaKtx
@MessageBuilderDSL
class InlineMessage(val builder: AbstractMessageBuilder) {
@@ -513,7 +505,6 @@ class InlineMessage(val builder: AbstractMessageBuilder) {
}
}
-@ReplaceJdaKtx
@MessageBuilderDSL
class InlineEmbed(val builder: EmbedBuilder) {
@@ -643,7 +634,6 @@ class Accumulator internal constructor() {
}
}
-@ReplaceJdaKtx
sealed interface MentionConfig {
val type: MentionType
@@ -688,7 +678,6 @@ class WhitelistMentionConfig(
}
}
-@ReplaceJdaKtx
data class Mentions(
var users: MentionConfig,
var roles: MentionConfig,
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ReplacingWith.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ReplacingWith.kt
index f0c240fb3..df67bdd63 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ReplacingWith.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/ReplacingWith.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.interactions.InteractionHook
import net.dv8tion.jda.api.requests.restaction.WebhookMessageEditAction
@@ -10,20 +9,17 @@ import net.dv8tion.jda.api.utils.messages.MessageEditData
/**
* @see InteractionHook.editOriginal
*/
-@DeprecatedInBcCore
fun InteractionHook.replaceWith(data: MessageEditData): WebhookMessageEditAction =
editOriginal(data).setReplace(true)
/**
* @see InteractionHook.editOriginal
*/
-@DeprecatedInBcCore
fun InteractionHook.replaceWith(data: MessageCreateData): WebhookMessageEditAction =
editOriginal(data.toEditData()).setReplace(true)
/**
* @see InteractionHook.editOriginal
*/
-@DeprecatedInBcCore
fun InteractionHook.replaceWith(content: String): WebhookMessageEditAction =
editOriginal(content).setReplace(true)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Sending.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Sending.kt
index ef451b3ed..240d67e72 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Sending.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/Sending.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.ReplaceJdaKtx
import net.dv8tion.jda.api.components.MessageTopLevelComponent
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.MessageEmbed
@@ -16,7 +15,6 @@ import net.dv8tion.jda.api.utils.messages.MessageRequest
/**
* @see IReplyCallback.reply
*/
-@ReplaceJdaKtx
inline fun IReplyCallback.reply_(
content: String? = null,
embeds: Collection = NO_CONTENT,
@@ -32,7 +30,6 @@ inline fun IReplyCallback.reply_(
/**
* @see InteractionHook.sendMessage
*/
-@ReplaceJdaKtx
inline fun InteractionHook.send(
content: String? = null,
embeds: Collection = NO_CONTENT,
@@ -48,7 +45,6 @@ inline fun InteractionHook.send(
/**
* @see MessageChannel.sendMessage
*/
-@ReplaceJdaKtx
inline fun MessageChannel.send(
content: String? = null,
embeds: Collection = NO_CONTENT,
@@ -64,7 +60,6 @@ inline fun MessageChannel.send(
* @see MessageChannel.sendMessage
* @see MessageCreateAction.setMessageReference
*/
-@ReplaceJdaKtx
inline fun Message.reply_(
content: String? = null,
embeds: Collection = NO_CONTENT,
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/SendingTo.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/SendingTo.kt
index c22589e37..1da202479 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/SendingTo.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/messages/SendingTo.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.messages
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.entities.Message
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel
import net.dv8tion.jda.api.interactions.InteractionHook
@@ -13,20 +12,17 @@ import net.dv8tion.jda.api.utils.messages.MessageCreateData
/**
* @see IReplyCallback.reply
*/
-@DeprecatedInBcCore
fun MessageCreateData.send(callback: IReplyCallback, ephemeral: Boolean = false): ReplyCallbackAction =
callback.reply(this).setEphemeral(ephemeral)
/**
* @see InteractionHook.sendMessage
*/
-@DeprecatedInBcCore
fun MessageCreateData.send(hook: InteractionHook, ephemeral: Boolean = false): WebhookMessageCreateAction =
hook.sendMessage(this).setEphemeral(ephemeral)
/**
* @see MessageChannel.sendMessage
*/
-@DeprecatedInBcCore
fun MessageCreateData.send(channel: MessageChannel): MessageCreateAction =
channel.sendMessage(this)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ranges/Ranges.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ranges/Ranges.kt
index 5f443b141..7b0ed7fa3 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ranges/Ranges.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/ranges/Ranges.kt
@@ -1,10 +1,8 @@
package dev.freya02.botcommands.jda.ktx.ranges
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.components.selections.SelectMenu
/**
* The minimum and maximum amount of values a user can select, must not exceed [SelectMenu.OPTIONS_MAX_AMOUNT].
*/
-@DeprecatedInBcCore
fun > SelectMenu.Builder<*, B>.setRequiredRange(range: IntRange): B = setRequiredRange(range.first, range.last)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/ErrorResponses.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/ErrorResponses.kt
index 85aabd515..17e0f32bc 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/ErrorResponses.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/ErrorResponses.kt
@@ -2,7 +2,6 @@
package dev.freya02.botcommands.jda.ktx.requests
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.exceptions.ErrorResponseException
import net.dv8tion.jda.api.requests.ErrorResponse
import kotlin.contracts.ExperimentalContracts
@@ -16,7 +15,6 @@ import kotlin.contracts.contract
* @see runIgnoringResponse
* @see runIgnoringResponseOrNull
*/
-@DeprecatedInBcCore
inline fun runCatchingResponse(ignored: ErrorResponse, vararg ignoredResponses: ErrorResponse, block: () -> R): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -34,7 +32,6 @@ inline fun runCatchingResponse(ignored: ErrorResponse, vararg ignoredRespons
* @see ignore
* @see runIgnoringResponseOrNull
*/
-@DeprecatedInBcCore
inline fun runIgnoringResponse(ignored: ErrorResponse, vararg ignoredResponses: ErrorResponse, block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -59,7 +56,6 @@ inline fun runIgnoringResponse(ignored: ErrorResponse, vararg ignoredResponses:
* @see runIgnoringResponse
* @see awaitOrNullOn
*/
-@DeprecatedInBcCore
inline fun runIgnoringResponseOrNull(ignored: ErrorResponse, vararg ignoredResponses: ErrorResponse, block: () -> R): R? {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestAction.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestAction.kt
index c58c0f6e7..b788656ea 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestAction.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestAction.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.requests
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import dev.freya02.botcommands.jda.ktx.coroutines.await
import net.dv8tion.jda.api.exceptions.ErrorHandler
import net.dv8tion.jda.api.requests.ErrorResponse
@@ -9,7 +8,6 @@ import net.dv8tion.jda.api.requests.RestAction
/**
* Awaits the completion of this RestAction.
*/
-@DeprecatedInBcCore
suspend fun RestAction<*>.awaitUnit() {
await()
}
@@ -17,7 +15,6 @@ suspend fun RestAction<*>.awaitUnit() {
/**
* Awaits the completion of this RestAction and returns `null`.
*/
-@DeprecatedInBcCore
suspend fun RestAction<*>.awaitNull(): R? {
await()
return null
@@ -30,7 +27,6 @@ suspend fun RestAction<*>.awaitNull(): R? {
*
* @see ErrorHandler
*/
-@DeprecatedInBcCore
fun RestAction<*>.queueIgnoring(ignored: ErrorResponse, vararg errorResponses: ErrorResponse) {
queue(null, ErrorHandler().ignore(ignored, *errorResponses))
}
@@ -43,7 +39,6 @@ fun RestAction<*>.queueIgnoring(ignored: ErrorResponse, vararg errorResponses: E
*
* @see runIgnoringResponseOrNull
*/
-@DeprecatedInBcCore
suspend fun RestAction.awaitOrNullOn(ignored: ErrorResponse, vararg errorResponses: ErrorResponse): R? {
return runIgnoringResponseOrNull(ignored, *errorResponses) {
await()
@@ -53,7 +48,6 @@ suspend fun RestAction.awaitOrNullOn(ignored: ErrorResponse, vararg error
/**
* Awaits the completion of this RestAction and wraps it in a Result.
*/
-@DeprecatedInBcCore
suspend fun RestAction.awaitCatching(): RestResult {
return runCatchingRest { await() }
}
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestResult.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestResult.kt
index 2ee791aa6..877d4bddf 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestResult.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/requests/RestResult.kt
@@ -2,7 +2,6 @@
package dev.freya02.botcommands.jda.ktx.requests
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import net.dv8tion.jda.api.exceptions.ErrorResponseException
import net.dv8tion.jda.api.requests.ErrorResponse
import kotlin.contracts.ExperimentalContracts
@@ -21,7 +20,6 @@ import kotlin.reflect.KClass
*/
@JvmInline
@Suppress("UNCHECKED_CAST")
-@DeprecatedInBcCore
value class RestResult @PublishedApi internal constructor(
@PublishedApi internal val value: Any?
) {
@@ -175,7 +173,6 @@ value class RestResult @PublishedApi internal constructor(
*
* Returns the original `RestResult` unchanged.
*/
-@DeprecatedInBcCore
inline fun RestResult.onErrorResponseException(block: (ErrorResponseException) -> Unit): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -194,7 +191,6 @@ inline fun RestResult.onErrorResponseException(block: (ErrorResponseExcep
* @see ignore
* @see handle
*/
-@DeprecatedInBcCore
inline fun RestResult.onErrorResponse(block: (ErrorResponse) -> Unit): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -213,7 +209,6 @@ inline fun RestResult.onErrorResponse(block: (ErrorResponse) -> Unit): Re
* @see ignore
* @see handle
*/
-@DeprecatedInBcCore
inline fun RestResult.onErrorResponse(error: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -232,7 +227,6 @@ inline fun RestResult.onErrorResponse(error: ErrorResponse, block: (Error
*
* @see handle
*/
-@DeprecatedInBcCore
inline fun RestResult.ignore(predicate: (Throwable) -> Boolean): RestResult {
contract {
callsInPlace(predicate, InvocationKind.AT_MOST_ONCE)
@@ -259,7 +253,6 @@ inline fun RestResult.ignore(predicate: (Throwable) -> Boolean): RestResu
*
* @see handle
*/
-@DeprecatedInBcCore
fun RestResult.ignore(ignored: ErrorResponse, vararg responses: ErrorResponse): RestResult =
ignore { it is ErrorResponseException && (it.errorResponse == ignored || it.errorResponse in responses) }
@@ -272,7 +265,6 @@ fun RestResult.ignore(ignored: ErrorResponse, vararg responses: ErrorResp
*
* @see handle
*/
-@DeprecatedInBcCore
fun RestResult.ignore(ignored: KClass, vararg types: KClass): RestResult =
ignore { throwable -> ignored.isInstance(throwable) || types.any { it.isInstance(throwable) } }
@@ -284,7 +276,6 @@ fun RestResult.ignore(ignored: KClass, vararg types: KClas
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.recover(predicate: (Throwable) -> Boolean, block: (Throwable) -> R): RestResult {
contract {
callsInPlace(predicate, InvocationKind.AT_MOST_ONCE)
@@ -309,7 +300,6 @@ inline fun RestResult.recover(predicate: (Throwable) -> Boolean, b
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.recover(response: ErrorResponse, vararg responses: ErrorResponse, block: (ErrorResponseException) -> R): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -329,7 +319,6 @@ inline fun RestResult.recover(response: ErrorResponse, vararg resp
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.recover(type: KClass, vararg types: KClass, block: (Throwable) -> R): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -351,7 +340,6 @@ inline fun RestResult.recover(type: KClass, vararg
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.handle(predicate: (Throwable) -> Boolean, block: (Throwable) -> Unit): RestResult {
contract {
callsInPlace(predicate, InvocationKind.UNKNOWN)
@@ -379,7 +367,6 @@ inline fun RestResult.handle(predicate: (Throwable) -> Boolean, block: (T
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.handle(type: ErrorResponse, vararg responses: ErrorResponse, block: (ErrorResponseException) -> Unit): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -401,7 +388,6 @@ inline fun RestResult.handle(type: ErrorResponse, vararg responses: Error
*
* @see ignore
*/
-@DeprecatedInBcCore
inline fun RestResult.handle(type: KClass, vararg types: KClass, block: (Throwable) -> Unit): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
@@ -418,7 +404,6 @@ inline fun RestResult.handle(type: KClass, vararg types: K
* catching any [Throwable] exception that was thrown from the [block] function execution
* and encapsulating it as a failure.
*/
-@DeprecatedInBcCore
inline fun runCatchingRest(block: () -> T): RestResult {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/Guild.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/Guild.kt
index e0b3c6ee4..b9d561e37 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/Guild.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/Guild.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.retrieve
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import dev.freya02.botcommands.jda.ktx.IgnoreForMatch
import dev.freya02.botcommands.jda.ktx.coroutines.await
import dev.freya02.botcommands.jda.ktx.deferredRestAction
@@ -37,7 +36,6 @@ import net.dv8tion.jda.internal.requests.RestActionImpl
*
* @see Guild.retrieveMemberById
*/
-@DeprecatedInBcCore
suspend fun Guild.retrieveMemberByIdOrNull(userId: String, @IgnoreForMatch useCache: Boolean = true): Member? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_MEMBER, ErrorResponse.UNKNOWN_USER) {
retrieveMemberById(userId).useCache(useCache).await()
@@ -55,7 +53,6 @@ suspend fun Guild.retrieveMemberByIdOrNull(userId: String, @IgnoreForMatch useCa
*
* @see Guild.retrieveMemberById
*/
-@DeprecatedInBcCore
suspend fun Guild.retrieveMemberByIdOrNull(userId: Long, @IgnoreForMatch useCache: Boolean = true): Member? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_MEMBER, ErrorResponse.UNKNOWN_USER) {
retrieveMemberById(userId).useCache(useCache).await()
@@ -73,7 +70,6 @@ suspend fun Guild.retrieveMemberByIdOrNull(userId: Long, @IgnoreForMatch useCach
*
* @see Guild.retrieveMember
*/
-@DeprecatedInBcCore
suspend fun Guild.retrieveMemberOrNull(user: UserSnowflake, @IgnoreForMatch useCache: Boolean = true): Member? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_MEMBER, ErrorResponse.UNKNOWN_USER) {
retrieveMember(user).useCache(useCache).await()
@@ -87,7 +83,6 @@ suspend fun Guild.retrieveMemberOrNull(user: UserSnowflake, @IgnoreForMatch useC
*
* @see Guild.retrieveBan
*/
-@DeprecatedInBcCore
suspend fun Guild.retrieveBanOrNull(user: UserSnowflake): Ban? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_BAN) {
retrieveBan(user).await()
@@ -102,7 +97,6 @@ suspend fun Guild.retrieveBanOrNull(user: UserSnowflake): Ban? {
*
* @see Guild.retrieveVanityInvite
*/
-@DeprecatedInBcCore
suspend fun Guild.retrieveVanityInviteOrNull(): VanityInvite? {
if (vanityCode == null) return null
@@ -118,9 +112,8 @@ suspend fun Guild.retrieveVanityInviteOrNull(): VanityInvite? {
*
* The [RestAction] may throw [InvalidChannelTypeException] if a channel with the ID was found, but isn't a thread.
*
- * @see retrieveThreadChannelOrNull
+ * @see retrieveThreadChannelByIdOrNull
*/
-@DeprecatedInBcCore
fun Guild.retrieveThreadChannelById(id: Long): CacheRestAction {
return jda.deferredRestAction(
valueSupplier = { getThreadChannelById(id) },
@@ -144,31 +137,12 @@ fun Guild.retrieveThreadChannelById(id: Long): CacheRestAction {
*
* The [RestAction] may throw [InvalidChannelTypeException] if a channel with the ID was found, but isn't a thread.
*
- * @see retrieveThreadChannelOrNull
+ * @see retrieveThreadChannelByIdOrNull
*/
fun Guild.retrieveThreadChannelById(id: String): CacheRestAction {
return retrieveThreadChannelById(MiscUtil.parseSnowflake(id))
}
-/**
- * Retrieves a thread by ID.
- *
- * The cached threads are checked first, and then a request is made.
- *
- * The returned thread may be null if:
- * - It doesn't exist
- * - The bot doesn't have access to it
- * - The channel isn't a thread
- *
- * @see retrieveThreadChannelById
- */
-@DeprecatedInBcCore
-@Deprecated("Replaced by retrieveThreadChannelByIdOrNull")
-@Suppress("deprecated")
-suspend fun Guild.retrieveThreadChannelOrNull(id: Long): ThreadChannel? {
- return retrieveThreadChannelByIdOrNull(id)
-}
-
/**
* Retrieves a thread by ID.
*
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/InvalidChannelTypeException.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/InvalidChannelTypeException.kt
index 5e503b42d..e0390f2a9 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/InvalidChannelTypeException.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/InvalidChannelTypeException.kt
@@ -1,11 +1,8 @@
package dev.freya02.botcommands.jda.ktx.retrieve
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
-
/**
* Exception thrown when retrieving a channel by ID, but the type is incorrect.
*
* @see retrieveThreadChannelById
*/
-@DeprecatedInBcCore
class InvalidChannelTypeException(message: String) : IllegalArgumentException(message)
diff --git a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/JDA.kt b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/JDA.kt
index c3f3a41aa..22dd707b3 100644
--- a/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/JDA.kt
+++ b/BotCommands-jda-ktx/src/main/kotlin/dev/freya02/botcommands/jda/ktx/retrieve/JDA.kt
@@ -1,6 +1,5 @@
package dev.freya02.botcommands.jda.ktx.retrieve
-import dev.freya02.botcommands.jda.ktx.DeprecatedInBcCore
import dev.freya02.botcommands.jda.ktx.IgnoreForMatch
import dev.freya02.botcommands.jda.ktx.coroutines.await
import dev.freya02.botcommands.jda.ktx.requests.runIgnoringResponseOrNull
@@ -22,7 +21,6 @@ import net.dv8tion.jda.api.requests.ErrorResponse
*
* @see JDA.retrieveUserById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveUserByIdOrNull(userId: String, @IgnoreForMatch useCache: Boolean = true): User? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_USER) {
retrieveUserById(userId).useCache(useCache).await()
@@ -39,7 +37,6 @@ suspend fun JDA.retrieveUserByIdOrNull(userId: String, @IgnoreForMatch useCache:
*
* @see JDA.retrieveUserById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveUserByIdOrNull(userId: Long, @IgnoreForMatch useCache: Boolean = true): User? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_USER) {
retrieveUserById(userId).useCache(useCache).await()
@@ -53,7 +50,6 @@ suspend fun JDA.retrieveUserByIdOrNull(userId: Long, @IgnoreForMatch useCache: B
*
* @see JDA.retrieveSticker
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveStickerOrNull(sticker: StickerSnowflake): StickerUnion? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_STICKER) {
retrieveSticker(sticker).await()
@@ -67,7 +63,6 @@ suspend fun JDA.retrieveStickerOrNull(sticker: StickerSnowflake): StickerUnion?
*
* @see JDA.retrieveEntitlementById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: String): Entitlement? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_ENTITLEMENT) {
retrieveEntitlementById(entitlementId).await()
@@ -81,7 +76,6 @@ suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: String): Entitlemen
*
* @see JDA.retrieveEntitlementById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: Long): Entitlement? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_ENTITLEMENT) {
retrieveEntitlementById(entitlementId).await()
@@ -95,7 +89,6 @@ suspend fun JDA.retrieveEntitlementByIdOrNull(entitlementId: Long): Entitlement?
*
* @see JDA.retrieveWebhookById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveWebhookByIdOrNull(webhookId: String): Webhook? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_WEBHOOK) {
retrieveWebhookById(webhookId).await()
@@ -109,7 +102,6 @@ suspend fun JDA.retrieveWebhookByIdOrNull(webhookId: String): Webhook? {
*
* @see JDA.retrieveWebhookById
*/
-@DeprecatedInBcCore
suspend fun JDA.retrieveWebhookByIdOrNull(webhookId: Long): Webhook? {
return runIgnoringResponseOrNull(ErrorResponse.UNKNOWN_WEBHOOK) {
retrieveWebhookById(webhookId).await()
diff --git a/BotCommands-jda-ktx/src/test/kotlin/dev/freya02/botcommands/jda/ktx/MigrationSnapshotTest.kt b/BotCommands-jda-ktx/src/test/kotlin/dev/freya02/botcommands/jda/ktx/MigrationSnapshotTest.kt
deleted file mode 100644
index 145fc29f0..000000000
--- a/BotCommands-jda-ktx/src/test/kotlin/dev/freya02/botcommands/jda/ktx/MigrationSnapshotTest.kt
+++ /dev/null
@@ -1,37 +0,0 @@
-package dev.freya02.botcommands.jda.ktx
-
-import java.util.zip.ZipEntry
-import java.util.zip.ZipInputStream
-import kotlin.io.path.Path
-import kotlin.io.path.readBytes
-import kotlin.test.Test
-import kotlin.test.fail
-
-class MigrationSnapshotTest {
-
- private val kspOutput = Path(System.getenv("KSP_OUTPUT"))
-
- @Test
- fun `Ensure generated migration files are not modified`() {
- val diffFiles = mutableSetOf()
-
- MigrationSnapshotTest::class.java.getResourceAsStream("/ksp_snapshot.zip")!!.use { inputStream ->
- ZipInputStream(inputStream).use { zipStream ->
- var entry: ZipEntry? = null
- while (zipStream.nextEntry.also { entry = it } != null) {
- if (entry!!.isDirectory) continue
- val frozenBytes = zipStream.readAllBytes()
- val generatedBytes = kspOutput.resolve(entry.name).readBytes()
-
- if (!(frozenBytes contentEquals generatedBytes)) {
- diffFiles += entry.name
- }
- }
- }
- }
-
- if (diffFiles.isNotEmpty()) {
- fail("Migration files should have not changed:\n${diffFiles.joinToString("\n")}")
- }
- }
-}
diff --git a/BotCommands-jda-ktx/src/test/resources/ksp_snapshot.zip b/BotCommands-jda-ktx/src/test/resources/ksp_snapshot.zip
deleted file mode 100644
index 4e1d3f590..000000000
Binary files a/BotCommands-jda-ktx/src/test/resources/ksp_snapshot.zip and /dev/null differ
diff --git a/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/api/core/config/JDAConfiguration.kt b/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/api/core/config/JDAConfiguration.kt
index 876dde766..008f4f9a8 100644
--- a/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/api/core/config/JDAConfiguration.kt
+++ b/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/api/core/config/JDAConfiguration.kt
@@ -2,16 +2,10 @@ package io.github.freya022.botcommands.api.core.config
import io.github.freya022.botcommands.api.core.JDAService
import io.github.freya022.botcommands.internal.core.config.ConfigurationValue
-import io.github.freya022.botcommands.internal.core.config.DeprecatedValue
import io.github.freya022.botcommands.internal.core.config.IgnoreDefaultValue
import net.dv8tion.jda.api.requests.GatewayIntent
import net.dv8tion.jda.api.utils.cache.CacheFlag
import org.springframework.boot.context.properties.ConfigurationProperties
-import org.springframework.boot.context.properties.bind.Name
-import org.springframework.context.event.ContextClosedEvent
-import java.time.Duration as JavaDuration
-import kotlin.time.Duration
-import kotlin.time.toKotlinDuration
/**
* Configuration properties for [JDAService].
@@ -38,36 +32,4 @@ class JDAConfiguration internal constructor(
@IgnoreDefaultValue
@ConfigurationValue("jda.cacheFlags")
val cacheFlags: Set = emptySet(),
- @Suppress("DEPRECATION")
- @param:Name("devtools")
- @Deprecated("For removal")
- val devTools: DevTools = DevTools(),
-) {
-
- @Deprecated("For removal")
- class DevTools internal constructor(
- /**
- * When Spring devtools are enabled,
- * enables shutting down JDA when the IoC container [closes][ContextClosedEvent].
- *
- * If you disable this, you must shut down JDA manually,
- * not doing so will let old instances run, receive events and cause unwanted behavior.
- *
- * Default: `true`
- */
- @ConfigurationValue("jda.devtools.enabled", defaultValue = "true")
- @Deprecated("Replaced by the built-in shutdown hook")
- @DeprecatedValue("Replaced by the built-in shutdown hook", replacement = "botcommands.core.enableShutdownHook")
- val enabled: Boolean = true,
- shutdownTimeout: JavaDuration = JavaDuration.ofSeconds(10),
- ) {
- /**
- * Time to wait until JDA needs to be forcefully shut down,
- * in other words, this is the allowed time for a graceful shutdown.
- */
- @Deprecated("For removal, shutdown is always forced")
- @DeprecatedValue("For removal, shutdown is always forced")
- @ConfigurationValue("jda.devtools.shutdownTimeout", type = "java.time.Duration", defaultValue = "10s")
- val shutdownTimeout: Duration = shutdownTimeout.toKotlinDuration()
- }
-}
+)
diff --git a/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/internal/core/config/BotCommandsConfigurations.kt b/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/internal/core/config/BotCommandsConfigurations.kt
index a96781124..d561ecd1b 100644
--- a/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/internal/core/config/BotCommandsConfigurations.kt
+++ b/BotCommands-spring/src/main/kotlin/io/github/freya022/botcommands/internal/core/config/BotCommandsConfigurations.kt
@@ -5,7 +5,6 @@ import io.github.freya022.botcommands.api.core.config.*
import io.github.freya022.botcommands.api.core.config.application.cache.ApplicationCommandsCacheConfig
import io.github.freya022.botcommands.api.core.config.application.cache.ApplicationCommandsCacheConfigBuilder
import io.github.freya022.botcommands.api.utils.EmojiUtils
-import net.dv8tion.jda.api.events.Event
import net.dv8tion.jda.api.interactions.DiscordLocale
import net.dv8tion.jda.api.requests.GatewayIntent
import org.springframework.boot.context.properties.ConfigurationProperties
@@ -23,8 +22,6 @@ internal class BotCommandsCoreConfiguration(
override val disableExceptionsInDMs: Boolean = false,
override val enableOwnerBypass: Boolean = false,
override val ignoredIntents: Set = emptySet(),
- @Deprecated("Replaced by EventWaiterBuilder.ignoreMissingIntents()")
- override val ignoredEventIntents: Set> = emptySet(),
override val ignoreRestRateLimiter: Boolean = false,
override val enableShutdownHook: Boolean = true,
) : BConfigProps {
@@ -38,8 +35,6 @@ internal fun BConfigBuilder.applyConfig(configuration: BotCommandsCoreConfigurat
disableExceptionsInDMs = configuration.disableExceptionsInDMs
enableOwnerBypass = configuration.enableOwnerBypass
ignoredIntents += configuration.ignoredIntents
- @Suppress("DEPRECATION")
- ignoredEventIntents += configuration.ignoredEventIntents
ignoreRestRateLimiter = configuration.ignoreRestRateLimiter
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 10ba9efe1..000000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,381 +0,0 @@
-# V3 Overview
-
-While V3 has most major features reworked and improved, this came to a cost;
-in particular, some parts of the API are now built toward Kotlin users.
-It is not sure how the API may be adapted to fit Java users more.
-
-While some features that require configuration using a DSL appeal more to Kotlin users,
-they should still be usable by Java users.
-
-Fortunately, annotation-driven features that already existed can still be used with no problem, both in Java and Kotlin.
-
-You can also refer to the [examples](BotCommands-core/src/examples) and the [wiki](https://bc.freya02.dev/3.X)
-to have an idea on how V3 is supposed to be used.
-
-## Base package change
-To better align with the Maven coordinates, the base package has changed from `com.freya02` to `io.github.freya022`.
-
-Fixing this should be as simple as using Find & Replace.
-
-## Kotlin support
-All commands and handlers support coroutines (except service factories) and default parameters.
-
-Each feature has its own `CoroutineScope`, configurable in `BCoroutineScopesConfigBuilder`
-
-## New dependency injection
-In V2, you had to register your resolvers, instances, instance suppliers... using `ExtensionsBuilder`, which enabled you to use constructor and field injection.
-
-In V3, you no longer need to manually manage your instances manually, a basic DI framework can manage all your services, commands, handlers, resolvers... as long as you annotated them with their appropriate annotations.
-You then simply put a parameter in your constructor/method to receive the requested service type.
-
-`@BService`, `@Command` and `@Resolver` are the annotations you will need the most.
-
-Spring IoC is also supported.
-
-### Services and factories
-`@BService` can be used to declare classes as services, or, when used on a method, serves as a factory for the return type.
-As always, if they are on your search path, then they will be instantiated when building the framework,
-and available to other classes.
-
-These services can all have a name, in case you want multiple services of the same type, but want to differentiate them.
-
-#### Primary providers
-When requesting a service, only one service must correspond to the given type/name.
-
-If multiple service providers exist, only one must be usable, or, only one must be marked primary (using `@Primary`).
-
-**Note:** Service factories are prioritized over annotated classes.
-
-**Kotlin note:** Service factories can be top-level functions.
-
-### Conditional services
-#### Interfaced conditions
-`@ConditionalService` can be used when you want your service/command/resolver... to be created under certain conditions.
-The annotation will only let the service be created if all the specified check interfaces passes.
-
-#### Annotation conditions
-`@Condition` is a meta-annotation that can be used on an annotation you create,
-which enables this annotation to represent a custom condition for service creation.
-
-You can also specify if failure of these annotations throws an exception.
-
-[//]: # (An example can be found [here](wiki/src/main/kotlin/io/github/freya022/wiki/switches/wiki/WikiLanguage.kt).)
-
-### Interfaced services
-You can find the `@InterfacedService` annotations on some interfaces of the framework, such as `SettingsProvider` or `IHelpCommand`.
-This annotation indicates that this interface can be implemented, but needs to be registered as a service.
-This is useful for when the framework needs an instance of the interface, without knowing what the implementation is.
-For example, if you want to override the help command, you will need to make an implementation for `IHelpCommand`.
-
-Most interfaces that were configurable in `CommandsBuilder` were replaced by interfaced services,
-such as command/component filters, `SettingsProvider`, `ExceptionHandler`, `AutocompleteTransformer`, etc...
-
-An example can be found [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/text/HelpCommand.kt).
-
-## Annotated command changes
-Annotated text and slash commands suffered from several issues,
-due to the data either being applied to the wrong part of the command,
-or no data being applicable on a part of a command (such as subcommand group descriptions).
-
-To reduce confusion about which property applies to what, and reduce undefined behaviors,
-annotations with distinct scopes were introduced:
-
-Slash commands:
-- (Required) `@JDASlashCommand(name, group, subcommand, description)`
-- (Required once, when using subcommands) `@TopLevelSlashCommandData(scope, defaultLocked, nsfw, description)`
-- (Optional) `@SlashCommandGroupData(description)`
-
-Text commands:
-- (Required) `@JDATextCommandVariation(path, order, description, usage, example)`
-- (Optional) `@TextCommandData(path, aliases, description)`, this must be used alongside `@JDATextCommandVariation`,
- `path` is the path this annotation applies to, defaults to the variation's path
-
-This way ensures that the data is only applied to a specific command,
-and does not need to be repeated, or follow specific orders.
-
-More details [on the PR](https://github.com/freya022/BotCommands/pull/146).
-
-## New command declarations
-Commands can now be declared using a DSL, these works best if you use Kotlin.
-
-### Declaration DSL
-To use the DSL, you can check out `GlobalApplicationCommandProvider`/`GuildApplicationCommandProvider`
-and `TextCommandProvider`.
-
-The DSL can help you provide each parameter explicitly, without the need for annotations,
-and also enables more features, such as [option aggregates](#option-aggregates).
-
-The DSL also enables you to declare commands with code, configure your names, descriptions, choices... everything by code,
-so you are not limited to static values with annotations.
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashBan.kt),
-see `SlashBanDetailedFront#declareGlobalApplicationCommands`.
-
-## New option aggregates
-Option aggregates are a way to combine multiple options into one object,
-the function that combines all the options can be anything, including a constructor.
-
-### Option aggregates
-Normal aggregates can accept any option type (Discord option, custom option or generated option).
-
-You can still insert options without declaring an aggregate; these options will implicitly have an aggregate created for you.
-
-**Note:** Option aggregates are only available with DSL declaration (and components and modal handlers by using `@Aggregate`).
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashBan.kt),
-see `aggregate` in `SlashBanDetailedFront#declareGlobalApplicationCommands`.
-
-### Vararg options
-Vararg options are a special type of option aggregate, they are essentially an aggregate that generates N options,
-and the aggregator just accepts a `List` and returns it as-is, i.e. your parameter accepts a `List`, not a real vararg.
-
-You can use these with `optionVararg`.
-
-**Note**: Aggregators can accept `List` parameters, but all the options must be under the same *declared* parameter name, so they can be all put in the list.
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashChoose.kt).
-
-### Inline class options
-Kotlin's inline classes can also be used as options,
-you can use `inlineClassOption` to declare one in the DSL, they also automatically work for annotated commands.
-
-`inlineClassOptionVararg` can also be used for inline classes that accept a varargs.
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashSentence.kt),
-with `SlashSentence.SentenceParts`.
-
-## New rate limiting
-A [token bucket](https://en.wikipedia.org/wiki/Token_bucket)-based rate limiting has been added,
-while `@Cooldown` still exists, `@RateLimit` now lets you define buckets, with multiple bandwidths,
-letting you create custom rate limiting for each of your command/component handler.
-
-A common example is a spike protected bucket, which, in addition to the normal rate limit,
-helps you prevent users from spamming a command in a short period of time,
-forcing them to spread out your resource usage.
-
-Rate limits can be used with:
-- `@RateLimit` (for annotated commands)
-- `#rateLimit`/`#cooldown` (for DSL commands)
-- `#rateLimitReference` (for DSL commands and components)
-- A provider, by implementing `RateLimitProvider` and using `RateLimitManager#rateLimit`,
- using them is as simple as using `@RateLimitReference` for annotated commands,
- or `#rateLimitReference` for DSL commands and components.
-
-A bucket token can be added back by using your event's `#cancelRateLimit()`,
-which effectively cancels the rate limit applied before entering any handler.
-
-## Improved filters
-
-In addition to being implemented as services, filters can now be used on specific commands / components.
-
-These filters can be declared as global filters, but must override the `global` property with `false`,
-you can then reference those filters in:
-- `@Filter`: Requires all filters to pass, can only be used on commands
-- The `filters` property of command DSLs, you can even combine filters using `and` and `or`,
-such as `filters += (filter() or filter()) and filter()`
-
-Component filters must be passed while building the components, and have the same usage as for command DSLs.
-Java users can also use the `addFilter` methods.
-
-## Autocomplete changes
-Autocomplete annotations and event have been renamed using `Autocomplete` instead of `Autocompletion`.
-
-Other than that, `@CompositeKey` has been replaced by `compositeKeys` on `@CacheAutocomplete`.
-This lets you configure what Discord options (you can also put the parameter name) must be in the caching key,
-even if the option is not being used by the autocomplete handler itself.
-
-The slash command DSL also let you configure autocomplete by using `SlashCommandOptionBuilder#autocomplete` (or `SlashCommandOptionBuilder#autocompleteReference` for handlers defined by annotation).
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashSentence.kt),
-on `SlashSentence#onSentencePartAutocomplete`.
-
-## Text command changes
-
-Text commands no longer have a `name`/`group`/`subcommand`, they have a `path` instead, which is an array of string.
-
-**Note:** Text commands are still limited to three path parts.
-
-## New built-in help command
-The command-specific embed has been revamped,
-and has separated descriptions for the command and the variations themselves.
-
-You can also add per-variant usage and examples, both in annotations and in the DSLs.
-
-
-Example
-
-For the [following commands](src/testBot/kotlin/dev/freya02/botcommands/bot/readme/TextBan.kt):
-
-
-
-
-## Async loading
-While V2 had to wait for your entire bot to be loaded,
-V3 **requires** you to start the framework before building JDA,
-which lets you get your stuff started up before the bot goes fully online.
-
-Building JDA before the framework will result in an error, I strongly recommend that you use a service which implements `JDAService`.
-
-You can also refer to [the example JDA service](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/Bot.kt).
-
-## Enhanced database support
-A `Database` service has been added,
-helping you get a decent abstraction for transactions and reading result rows with ease.
-`BlockingDatabase` is the equivalent for Java users, with the same features.
-
-### H2 Support
-While PostgreSQL is still strongly recommended, H2 is also supported, but requires the PostgreSQL compatibility mode.
-
-This allows you to run an in-memory database, or have it saved to a file,
-see [`ConnectionSupplier`](BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/db/ConnectionSupplier.kt) and [H2 Database connection modes](https://www.h2database.com/html/features.html#connection_modes) for more details.
-
-### Statement logging
-This service helps you create statements that are logged at the class that created the statement.
-That way, you can enable traces of some of your classes, without having everything else logged.
-
-The logged statements are reconstructed from the parametrized SQL, and then filled with the parameters,
-giving you an executable query, which can be run in a console.
-
-See [`Database`](BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/core/db/Database.kt) for more details.
-
-### Long transaction reporting
-Additionally, if `BDatabaseConfig#dumpLongTransactions` is enabled,
-the framework will report transactions taking longer than `ConnectionSupplier#maxTransactionDuration`,
-and will trigger a coroutine / thread dump.
-
-**Note:** Coroutine dumps require `kotlinx-coroutines-debug`, see `BDatabaseConfig#dumpLongTransactions` for more details.
-
-## New components
-The `Components` utility class is now a service, which means you can get it either in your constructor, or in your handler.
-
-Like in V2, your components can be set as being usable only once,
-being able to be used by certain users/with permissions/with roles...
-They can also be constructed using the builder pattern.
-
-Kotlin users can configure their components using a DSL,
-as well as having the handler, and the timeout handler be optional.
-
-As these handlers are optional, you can still handle them using coroutines, by using `await` on your component/group.
-
-**Note:** Components have a default timeout (set in `Components`), which invalidates the button after expiration.
-You can disable the timeout if necessary using `noTimeout()`, or if you plan on putting the component in a group.
-Kotlin users need to make sure to catch `ComponentCancellationException` when using `await()` on them.
-
-An example can be found [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashButton.kt).
-
-## New modals
-Just like components, modals are now created using a DSL, while their handlers are still annotated.
-
-The DSL is very similar to the component's DSL, with your usual `bindTo` and `setTimeout` functions, you can also await on your modals.
-
-**Note:** Modals also have a default timeout (set in `Modals`), which invalidates the modal after expiration.
-You can disable the timeout if necessary using `noTimeout()`.
-Kotlin users need to make sure to catch `ModalTimeoutException` when using `await()` on them.
-
-## New event handler
-
-`@BEventListener` can now be specified to be run asynchronously (within the parallelism limits of `BCoroutineScopesConfig#eventDispatcherScope`),
-they can also have a priority assigned to them, as well as a timeout, used for suspending handlers.
-
-An example can be found [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/ReadyListener.kt).
-
-## Suspend resolvers & resolver factories
-`ParameterResolver` is now type safe and also supports coroutines.
-
-### Suspending resolvers
-Parameter resolvers in Java can override the usual `resolve` method, while Kotlin users can override the `resolveSuspend` function. This is particularly useful when you need to execute a `RestAction`, so you can await without blocking the thread.
-
-### Resolver factories
-Resolver factories were also added to enable you to give a parameter resolver based on the parameter of the function.
-
-That way, you can return resolvers based on your own conditions,
-for example, given the parameter's annotations or generics.
-
-*This is how `[App/Text]LocalizationContext` are injected, they use factories of `ICustomResolver`,
-and when you put a parameter, they read that parameter for `@LocalizationBundle` and then construct a resolver which gets you the correct localization bundle.*
-
-### Resolvers (& factories) from service factories
-Resolvers can not only be created from classes, but also from service factories (function with `@BService`)
-returning an implementation.
-
-For example, the framework provides `Resolver#enumResolver`, which can help you quickly handle any enumeration,
-while also (optionally) letting you transform a value into its displayed string.
-
-## Enhanced localization API
-The API has been improved to allow a more detailed loading mechanism,
-as to let you extend the API, such as adding support for new formats (like HOCON), or new file structures:
-
-| Name | Function |
-|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| [LocalizationMapProvider](BotCommands-core/src/main/java/io/github/freya022/botcommands/api/localization/providers/LocalizationMapProvider.java) | Responsible for getting a `LocalizationMap` for a given base name and locale, using a broader locale is allowed.
The provider can merge multiple maps as well as modify the base name.
All providers can be found by using `LocalizationService#getMappingProviders`. |
-| [LocalizationMapReader](BotCommands-core/src/main/java/io/github/freya022/botcommands/api/localization/readers/LocalizationMapReader.java) | Responsible for reading a given localization map for a given bundle name (base name + locale).
It is allowed to create any type of `LocalizationTemplate`, but is **not** allowed to use a different name or locale.
All readers can be found by using `LocalizationService#getMappingReaders`. |
-| [LocalizationMapTemplate](BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/LocalizationTemplate.kt) | Represents a localization template, i.e., the entire string with parameters in it. |
-| [FormattableArgumentFactory](BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/localization/arguments/factories/FormattableArgumentFactory.kt) | Responsible for creating `FormattableArgument`s based on an argument found in a template.
All factories can be found by using `LocalizationService#getFormattableArgumentFactories`. |
-
-The old `Localization` factory is now `LocalizationService`.
-
-## New in-interaction localization
-As briefly explained above, localization has been moved from the framework events, into injectable instances, `[App/Text]LocalizationContext`.
-
-Naturally, `AppLocalizationContext` can only be used with interactions (application commands, components, modals), while `TextLocalizationContext` can be used in interactions and `MessageReceivedEvent` handlers.
-
-These parameters must be annotated with `@LocalizationBundle`, as to specify where to take the translations from,
-and optionally, with what prefix.
-
-You can specify as many of them as you'd like, as well as construct them manually using the static methods,
-or use `switchBundle` which changes the target bundle and clears the prefix.
-
-In addition, `#localize[X]orNull` can help you return `null` in case the given localization path does not exist.
-
-You can find an example [here](BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashBan.kt).
-
-## New pagination
-
-All paginators were reworked with several improvements, here is a list of the changes:
-### Name changes
-* `ButtonMenu` -> `ChoiceMenu`
-* `InteractiveMenu` -> `NestedPagination`
-
-### Usage changes
-* A `Paginators` service that serves as a pagination factory has to be used, improving discoverability
-* Mandatory parameters are no longer behind setters, they are requested by the factory
-
-### New features
-* `ButtonMenu` can now change the button style
-* `ButtonMenu` can have its buttons reused
-* Added support for Kotlin coroutines and `Duration`
- * Some callbacks (like `PageEditor`) cannot use coroutines as they are called by method overridable by Java users
-* `NestedPagination` saves the page number before switching
-
-### Changes
-* Most options use default values, such as paginator buttons and timeouts
-* Requesting a new page invalidates the replaced page's components, can be disabled
-* Paginators expire by default using the same timeout as in `Components`
-* Timeout consumers are optional, timeout can be entirely disabled
-* Page editors no longer require returning an embed, you can freely edit the message and/or the existing embed
-
-### Extension changes
-* Builders are passed instead of their individual values
-* Creating a message from the pagination's state is fully handled by the base class, and decomposed into steps that can be overridden
-
-## Misc
-
-### Command / Component filters
-Filters now support coroutines and are run right before their target should have been executed.
-
-### Extension functions
-Several top-level and extension functions have been added, see the [`BotCommands-jda-ktx`](BotCommands-jda-ktx) module.
-
-### Input user parameters
-A `InputUser` interface, extending `User`, provides a way for you to get a Member (null if not available)
-alongside the non-null User, without retrieving.
-
-This is particularly useful for commands that work for both `User`s and `Member`s,
-but where having a `Member` triggers additional checks, such as in ban commands.
-
-### Emoji library change
-[emoji-java](https://github.com/MinnDevelopment/emoji-java) has been replaced with [JEmoji](https://github.com/felldo/JEmoji),
-providing a more up-to-date emoji list,
-also allowing dropping `org.json` and fixing issues with emoji indexes, and incorrect fitzpatrick formats.
-
-[jda-emojis](https://github.com/freya022/jda-emojis) was also added to get `UnicodeEmoji`s directly.
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 82c40801d..d8325e10f 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -12,7 +12,6 @@ jackson = "2.21.1"
java-string-similarity = "2.0.0"
jda = "6.3.2"
jda-emojis = "3.0.0"
-jda-ktx = "0.12.0"
jemoji = "1.7.5"
jetbrains-annotations = "26.0.2"
jetbrains-markdown = "0.7.3"
@@ -59,7 +58,6 @@ jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-
java-string-similarity = { module = "info.debatty:java-string-similarity", version.ref = "java-string-similarity" }
jda = { module = "net.dv8tion:JDA", version.ref = "jda" }
jda-emojis = { module = "dev.freya02:jda-emojis", version.ref = "jda-emojis" }
-jda-ktx = { module = "club.minnced:jda-ktx", version.ref = "jda-ktx" }
jemoji = { module = "net.fellbaum:jemoji", version.ref = "jemoji" }
jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrains-annotations" }
jetbrains-markdown = { module = "org.jetbrains:markdown", version.ref = "jetbrains-markdown" }
@@ -77,7 +75,6 @@ kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-c
kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" }
kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
-ksp-aa = { module = "com.google.devtools.ksp:symbol-processing-aa-embeddable", version.ref = "ksp" }
logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback-classic" }
maven-publish-plugin = { module = "com.vanniktech.maven.publish:com.vanniktech.maven.publish.gradle.plugin", version.ref = "maven-publish-plugin" }
mockk = { module = "io.mockk:mockk-jvm", version.ref = "mockk" }
diff --git a/jda-ktx-deprecation-processor/build.gradle.kts b/jda-ktx-deprecation-processor/build.gradle.kts
deleted file mode 100644
index c5c7bc3cd..000000000
--- a/jda-ktx-deprecation-processor/build.gradle.kts
+++ /dev/null
@@ -1,23 +0,0 @@
-plugins {
- id("repositories-conventions")
- id("kotlin-conventions")
-}
-
-dependencies {
- implementation(libs.ksp)
- implementation(libs.ksp.aa)
-
- implementation(libs.jspecify)
-
- implementation(libs.classgraph)
- implementation(libs.kotlin.metadata)
- runtimeOnly(libs.jda.ktx)
-}
-
-kotlin {
- compilerOptions {
- freeCompilerArgs.addAll(
- "-Xcontext-parameters",
- )
- }
-}
diff --git a/jda-ktx-deprecation-processor/src/main/java/dev/freya02/botcommands/jda/ktx/deprecation/utils/KaAccessor.java b/jda-ktx-deprecation-processor/src/main/java/dev/freya02/botcommands/jda/ktx/deprecation/utils/KaAccessor.java
deleted file mode 100644
index 1dc2bf055..000000000
--- a/jda-ktx-deprecation-processor/src/main/java/dev/freya02/botcommands/jda/ktx/deprecation/utils/KaAccessor.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package dev.freya02.botcommands.jda.ktx.deprecation.utils;
-
-import com.google.devtools.ksp.impl.symbol.kotlin.KSFunctionDeclarationImpl;
-import com.google.devtools.ksp.symbol.KSFunctionDeclaration;
-import ksp.org.jetbrains.kotlin.analysis.api.symbols.KaFunctionSymbol;
-import org.jspecify.annotations.NullMarked;
-
-@NullMarked
-public class KaAccessor {
-
- public static KaFunctionSymbol getKaFunctionSymbol(KSFunctionDeclaration declaration) {
- return ((KSFunctionDeclarationImpl) declaration).getKtFunctionSymbol$kotlin_analysis_api();
- }
-}
diff --git a/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/CompatSourceFile.kt b/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/CompatSourceFile.kt
deleted file mode 100644
index 811cecaf1..000000000
--- a/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/CompatSourceFile.kt
+++ /dev/null
@@ -1,10 +0,0 @@
-package dev.freya02.botcommands.jda.ktx.deprecation
-
-import com.google.devtools.ksp.symbol.KSFile
-
-data class CompatSourceFile(
- val processedFile: KSFile,
- val packageName: String,
- val fileName: String,
- val content: String,
-)
diff --git a/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/FindReplacePairs.kt b/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/FindReplacePairs.kt
deleted file mode 100644
index 0fdaf9d7a..000000000
--- a/jda-ktx-deprecation-processor/src/main/kotlin/dev/freya02/botcommands/jda/ktx/deprecation/FindReplacePairs.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package dev.freya02.botcommands.jda.ktx.deprecation
-
-import com.google.devtools.ksp.containingFile
-import com.google.devtools.ksp.symbol.KSAnnotated
-import com.google.devtools.ksp.symbol.KSFile
-
-class FindReplacePairs {
-
- private val _processedFiles = mutableListOf()
- val processedFiles: List get() = _processedFiles
-
- private val _pairs = sortedMapOf