From ffeff8c045f738061f7dec82d3311f52c551a265 Mon Sep 17 00:00:00 2001
From: freya02 <41875020+freya022@users.noreply.github.com>
Date: Tue, 4 Feb 2025 17:27:38 +0100
Subject: [PATCH] Remove deprecated elements and prepare for beta (#212)
---
.../botcommands/api/commands/CommandList.java | 104 ---
.../commands/application/CommandScope.java | 8 -
.../api/commands/text/BaseCommandEvent.java | 4 +-
.../api/core/SettingsProvider.java | 90 ---
.../application/ApplicationCommand.kt | 23 -
.../application/ApplicationCommandInfo.kt | 3 -
.../api/commands/application/CommandMap.kt | 8 -
.../TopLevelApplicationCommandBuilder.kt | 15 -
.../context/message/MessageCommandInfo.kt | 5 -
.../options/MessageContextCommandOption.kt | 2 -
.../options/MessageContextCommandParameter.kt | 2 -
.../context/user/UserCommandInfo.kt | 5 -
.../user/options/UserContextCommandOption.kt | 2 -
.../options/UserContextCommandParameter.kt | 2 -
.../commands/application/diff/DiffEngine.kt | 14 -
.../options/ApplicationCommandOption.kt | 2 -
.../options/ApplicationCommandParameter.kt | 2 -
.../AbstractApplicationCommandManager.kt | 34 -
.../application/slash/SlashCommandInfo.kt | 5 -
.../autocomplete/AutocompleteCacheMode.kt | 17 -
.../annotations/CacheAutocomplete.kt | 21 +-
.../builder/AutocompleteCacheInfoBuilder.kt | 7 +-
.../builder/AutocompleteInfoBuilder.kt | 15 -
.../slash/options/SlashCommandOption.kt | 2 -
.../slash/options/SlashCommandParameter.kt | 2 -
.../api/commands/options/CommandOption.kt | 7 +-
.../api/commands/options/CommandParameter.kt | 10 +-
.../api/commands/text/TextCommandVariation.kt | 5 -
.../api/commands/text/TextCommandsContext.kt | 38 --
.../text/options/TextCommandOption.kt | 2 -
.../text/options/TextCommandParameter.kt | 2 -
.../botcommands/api/components/Components.kt | 34 -
.../builder/EphemeralHandlerBuilder.kt | 14 -
.../builder/IActionableComponent.kt | 416 +-----------
.../builder/ITimeoutableComponent.kt | 605 ------------------
.../components/builder/IUniqueComponent.kt | 29 -
.../builder/PersistentHandlerBuilder.kt | 42 --
.../api/components/utils/ButtonContent.kt | 43 --
.../freya022/botcommands/api/core/BBuilder.kt | 77 ---
.../freya022/botcommands/api/core/BContext.kt | 217 -------
.../botcommands/api/core/BotCommands.kt | 17 -
.../botcommands/api/core/Executable.kt | 18 -
.../api/core/annotations/BEventListener.kt | 4 +-
.../api/core/annotations/EnableBotCommands.kt | 77 ---
.../api/core/config/BApplicationConfig.kt | 93 ---
.../api/core/config/BComponentsConfig.kt | 23 -
.../botcommands/api/core/config/BConfig.kt | 88 ---
.../api/core/config/BDebugConfig.kt | 51 --
.../api/core/config/BServiceConfig.kt | 56 --
.../api/core/config/BTextConfig.kt | 7 +-
.../api/core/config/ConfigConfigurers.kt | 17 -
.../api/core/db/ConnectionSupplier.kt | 2 +-
.../botcommands/api/core/db/SQLCodes.kt | 15 -
.../api/core/service/InstanceSupplier.kt | 16 -
.../api/core/service/LazyService.kt | 2 +-
.../api/core/service/ServiceContainer.kt | 41 +-
.../service/annotations/InterfacedService.kt | 2 -
.../botcommands/api/core/utils/ClassGraph.kt | 6 +-
.../botcommands/api/core/utils/JDA.kt | 10 -
.../freya022/botcommands/api/modals/Modals.kt | 5 -
.../api/parameters/AggregatedParameter.kt | 24 -
.../resolvers/ComponentParameterResolver.kt | 10 -
.../parameters/resolvers/ICustomResolver.kt | 13 +-
.../MessageContextParameterResolver.kt | 11 -
.../resolvers/ModalParameterResolver.kt | 10 -
.../resolvers/SlashParameterResolver.kt | 11 -
.../resolvers/TextParameterResolver.kt | 20 -
.../resolvers/TimeoutParameterResolver.kt | 10 -
.../resolvers/UserContextParameterResolver.kt | 11 -
.../application/ApplicationCommandListener.kt | 6 +-
.../application/ApplicationCommandsUpdater.kt | 50 +-
.../commands/application/CommandMap.kt | 54 --
.../commands/application/NamedCommandMap.kt | 4 +-
.../commands/application/diff/DiffLogger.kt | 13 +-
.../diff/OldApplicationCommandDiffEngine.kt | 93 ---
...dRefactoredApplicationCommandDiffEngine.kt | 92 ---
.../slash/autocomplete/AutocompleteHandler.kt | 6 -
.../commands/autobuilder/AutoBuilderUtils.kt | 19 +-
.../commands/text/TextCommandsContextImpl.kt | 9 +-
.../impl/EphemeralActionableComponentImpl.kt | 9 +-
.../impl/PersistentActionableComponentImpl.kt | 10 +-
.../components/handler/ComponentDescriptor.kt | 24 -
.../components/timeout/TimeoutDescriptor.kt | 16 +-
.../botcommands/internal/core/BContextImpl.kt | 3 -
.../core/config/BotCommandsConfigurations.kt | 20 -
.../internal/core/config/ConfigProvider.kt | 9 -
.../internal/core/hooks/EventListenerList.kt | 2 +-
.../core/hooks/EventListenerRegistry.kt | 4 +-
.../builder/OptionAggregateBuilderImpl.kt | 2 +-
.../service/DefaultBotCommandsBootstrap.kt | 4 +-
.../service/DefaultServiceContainerImpl.kt | 94 +--
.../internal/core/service/LazyServiceImpl.kt | 149 +++--
.../core/service/provider/ServiceProvider.kt | 60 +-
.../core/service/provider/ServiceProviders.kt | 22 +-
.../internal/modals/ModalHandlerInfo.kt | 6 -
.../internal/parameters/OptionParameter.kt | 2 +-
.../parameters/ServiceMethodOption.kt | 7 +-
.../parameters/resolvers/DoubleResolver.kt | 4 +-
.../othertests/FunctionTypeTest.kt | 8 +-
99 files changed, 197 insertions(+), 3209 deletions(-)
delete mode 100644 src/main/java/io/github/freya022/botcommands/api/commands/CommandList.java
delete mode 100644 src/main/java/io/github/freya022/botcommands/api/core/SettingsProvider.java
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/commands/application/CommandMap.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/AutocompleteCacheMode.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/components/builder/EphemeralHandlerBuilder.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/components/builder/PersistentHandlerBuilder.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/core/BBuilder.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/core/annotations/EnableBotCommands.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/core/config/BDebugConfig.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/core/db/SQLCodes.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/api/core/service/InstanceSupplier.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/CommandMap.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/diff/OldApplicationCommandDiffEngine.kt
delete mode 100644 src/main/kotlin/io/github/freya022/botcommands/internal/commands/application/diff/OldRefactoredApplicationCommandDiffEngine.kt
diff --git a/src/main/java/io/github/freya022/botcommands/api/commands/CommandList.java b/src/main/java/io/github/freya022/botcommands/api/commands/CommandList.java
deleted file mode 100644
index 2f2b3dd21..000000000
--- a/src/main/java/io/github/freya022/botcommands/api/commands/CommandList.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package io.github.freya022.botcommands.api.commands;
-
-import io.github.freya022.botcommands.api.commands.application.CommandDeclarationFilter;
-import io.github.freya022.botcommands.api.commands.application.annotations.DeclarationFilter;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-
-/**
- * Represents a list of enabled commands, the enabled commands are only qualified by their base name.
- * Keep in mind you cannot disable global commands on a per-guild basis.
- *
- * @deprecated Replaced by {@link DeclarationFilter @DeclarationFilter} with {@link CommandDeclarationFilter}
- */
-@Deprecated
-public class CommandList {
- private final Predicate filter;
-
- private CommandList(Predicate filter) {
- this.filter = filter;
- }
-
- /**
- * Makes a list of usable commands (in a Guild context),
- * You have to insert full commands paths such as {@code name group subcommand}, which comes from the Discord representation of {@code /name group subcommand}
- * This is constructed by joining each path component with a space
- * Keep in mind you cannot enable global commands on a per-guild basis
- *
- * @param enabledCommandsStrs A collection of enabled command paths
- *
- * @return A {@link CommandList} of enabled command
- */
- public static CommandList of(Collection enabledCommandsStrs) {
- List enabledCommands = enabledCommandsStrs.stream().map(CommandPath::of).collect(Collectors.toList());
-
- return new CommandList(path -> containsCommand(enabledCommands, path));
- }
-
- private static boolean containsCommand(List commandOrGroupPaths, CommandPath path) {
- for (CommandPath commandOrGroupPath : commandOrGroupPaths) {
- if (path.startsWith(commandOrGroupPath)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Makes a list of unusable commands (in a Guild context),
- * You have to insert full commands paths such as {@code name group subcommand}, which comes from the Discord representation of {@code /name group subcommand}
- * This is constructed by joining each path component with a space
- * Keep in mind you cannot disable global commands on a per-guild basis
- *
- * @param disabledCommandsStrs A collection of disabled command paths
- *
- * @return A {@link CommandList} of disabled command
- */
- public static CommandList notOf(Collection disabledCommandsStrs) {
- List disabledCommands = disabledCommandsStrs.stream().map(CommandPath::of).collect(Collectors.toList());
-
- return new CommandList(path -> !containsCommand(disabledCommands, path));
- }
-
- /**
- * Makes a list that disables all of this current guild's commands
- *
- * @return A {@link CommandList} with no command enabled
- */
- public static CommandList none() {
- return new CommandList(s -> false);
- }
-
- /**
- * Makes a list that enables all of this current guild's commands
- *
- * @return A {@link CommandList} with all commands enabled
- */
- public static CommandList all() {
- return new CommandList(s -> true);
- }
-
- /**
- * Makes a list that enables current guild's commands if they satisfy the given predicate
- *
- * @param predicate The CommandPath predicate, returns {@code true} if the command can be used
- *
- * @return The CommandList for this predicate
- */
- public static CommandList filter(Predicate predicate) {
- return new CommandList(predicate);
- }
-
- /**
- * Return a predicate that returns true if the command can be used
- *
- * @return The filter predicate
- */
- public Predicate getFilter() {
- return filter;
- }
-}
diff --git a/src/main/java/io/github/freya022/botcommands/api/commands/application/CommandScope.java b/src/main/java/io/github/freya022/botcommands/api/commands/application/CommandScope.java
index acf764705..76a99073b 100644
--- a/src/main/java/io/github/freya022/botcommands/api/commands/application/CommandScope.java
+++ b/src/main/java/io/github/freya022/botcommands/api/commands/application/CommandScope.java
@@ -1,9 +1,6 @@
package io.github.freya022.botcommands.api.commands.application;
import io.github.freya022.botcommands.api.commands.application.annotations.DeclarationFilter;
-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.TopLevelSlashCommandData;
import io.github.freya022.botcommands.api.core.config.BApplicationConfigBuilder;
import net.dv8tion.jda.api.interactions.InteractionContextType;
@@ -26,9 +23,4 @@ public enum CommandScope {
*
These commands cannot be filtered.
*/
GLOBAL,
- /**
- * @deprecated Replace this by setting {@link TopLevelSlashCommandData#contexts()}/{@link JDAMessageCommand#contexts()}/{@link JDAUserCommand#contexts()} to {@link InteractionContextType#GUILD}
- */
- @Deprecated(forRemoval = true)
- GLOBAL_NO_DM;
}
diff --git a/src/main/java/io/github/freya022/botcommands/api/commands/text/BaseCommandEvent.java b/src/main/java/io/github/freya022/botcommands/api/commands/text/BaseCommandEvent.java
index 4e502d387..cc6ebfe09 100644
--- a/src/main/java/io/github/freya022/botcommands/api/commands/text/BaseCommandEvent.java
+++ b/src/main/java/io/github/freya022/botcommands/api/commands/text/BaseCommandEvent.java
@@ -108,7 +108,7 @@ public Member getMember() {
}
/**
- * Returns the default embed, equivalent to {@link BContext#getDefaultEmbedSupplier() BContext.getDefaultEmbedSupplier().get()}
+ * Returns the default embed, equivalent to {@link TextCommandsContext#getDefaultEmbedSupplier() BContext.getDefaultEmbedSupplier().get()}
*
* @return Default embed of the bot
*/
@@ -116,7 +116,7 @@ public Member getMember() {
public abstract EmbedBuilder getDefaultEmbed();
/**
- * Returns the default embed footer icon, equivalent to {@link BContext#getDefaultEmbedFooterIconSupplier() BContext.getDefaultFooterIconSupplier().get()}
+ * Returns the default embed footer icon, equivalent to {@link TextCommandsContext#getDefaultEmbedFooterIconSupplier() BContext.getDefaultFooterIconSupplier().get()}
*
* @return Default embed footer icon of the bot
*/
diff --git a/src/main/java/io/github/freya022/botcommands/api/core/SettingsProvider.java b/src/main/java/io/github/freya022/botcommands/api/core/SettingsProvider.java
deleted file mode 100644
index b999ee95f..000000000
--- a/src/main/java/io/github/freya022/botcommands/api/core/SettingsProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package io.github.freya022.botcommands.api.core;
-
-import io.github.freya022.botcommands.api.commands.CommandList;
-import io.github.freya022.botcommands.api.commands.application.CommandDeclarationFilter;
-import io.github.freya022.botcommands.api.commands.application.annotations.DeclarationFilter;
-import io.github.freya022.botcommands.api.commands.text.TextPrefixSupplier;
-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.DefaultMessages;
-import io.github.freya022.botcommands.api.localization.interaction.GuildLocaleProvider;
-import io.github.freya022.botcommands.api.localization.interaction.UserLocaleProvider;
-import io.github.freya022.botcommands.api.localization.text.TextCommandLocaleProvider;
-import net.dv8tion.jda.api.entities.Guild;
-import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
-import net.dv8tion.jda.api.interactions.DiscordLocale;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-import java.util.function.Predicate;
-
-/**
- * Interface for settings requested by the framework, such as prefixes, guild locale or guild commands whitelist.
- *
- *
- * Usage: Register your instance as a service with {@link BService}.
- *
- * @see InterfacedService @InterfacedService
- *
- * @deprecated For removal, all functions were deprecated
- */
-@Deprecated(forRemoval = true)
-@InterfacedService(acceptMultiple = false)
-public interface SettingsProvider {
- /**
- * Returns the list of prefix this Guild should use
- * If the returned list is null or empty, the global prefixes will be used
- *
- * @return The list of prefixes
- *
- * @deprecated Replaced by {@link TextPrefixSupplier#getPrefixes(GuildMessageChannel)}
- */
- @Nullable
- @Deprecated
- default List getPrefixes(@NotNull Guild guild) {
- return null;
- }
-
- /**
- * Returns the list of guild commands usable in that Guild.
- *
- * @return A CommandList of this guild's commands
- *
- * @see CommandList#all()
- * @see CommandList#none()
- * @see CommandList#of(Collection)
- * @see CommandList#notOf(Collection)
- * @see CommandList#filter(Predicate)
- *
- * @deprecated Replaced by {@link DeclarationFilter @DeclarationFilter} with {@link CommandDeclarationFilter}
- */
- @NotNull
- @Deprecated
- default CommandList getGuildCommands(@NotNull Guild guild) {
- return CommandList.all();
- }
-
- /**
- * Returns the {@link Locale} of the given {@link Guild}, will be null for a global context
- * This might be used for localization such as in default messages or application commands
- *
- * @param guild The target {@link Guild} to get the {@link Locale} from
- *
- * @return The {@link Locale} of the specified guild
- *
- * @see DefaultMessages
- *
- * @deprecated Replaced by {@link TextCommandLocaleProvider} / {@link UserLocaleProvider} / {@link GuildLocaleProvider}
- */
- @NotNull
- @Deprecated
- default DiscordLocale getLocale(@Nullable Guild guild) {
- if (guild != null) return guild.getLocale();
-
- //Discord default locale is US english
- return DiscordLocale.ENGLISH_US;
- }
-}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt
index 3e0038f53..7f0f896d1 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommand.kt
@@ -45,29 +45,6 @@ abstract class ApplicationCommand {
return emptyList()
}
- /**
- * Returns a collection of [Guild] IDs in which the specified command ID will be allowed to be pushed in.
- *
- * Return values:
- * - `null` if the command can be used in any guild
- * - An empty list if the command cannot be used anywhere
- * - A list of guild IDs, where the command will be usable
- *
- * Make sure to not allow more than one command with the same path.
- *
- * @param commandId The ID of the command that has been set with [@CommandId][CommandId]
- * @param commandPath The [CommandPath] of the specified command ID
- *
- * @return A collection of Guild IDs where the specified command is allowed to be pushed in
- * This returns `null` by default
- *
- * @see CommandId @CommandId
- */
- @Deprecated(message = "Replaced by DeclarationFilter and CommandDeclarationFilter")
- open fun getGuildsForCommandId(commandId: String, commandPath: CommandPath): Collection? {
- return null
- }
-
/**
* Returns the generated value supplier of a [@GeneratedOption][GeneratedOption].
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommandInfo.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommandInfo.kt
index 2548ed9e3..88833b65c 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommandInfo.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/ApplicationCommandInfo.kt
@@ -25,9 +25,6 @@ interface ApplicationCommandInfo : CommandInfo, Executable,
override val discordOptions: List
- @Deprecated("For removal, confusing on whether it searches nested parameters, prefer using collection operations on 'parameters' instead, make an extension or an utility method")
- override fun getParameter(declaredName: String): ApplicationCommandParameter?
-
/**
* Returns the full command name of this application command, separate with spaces.
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/CommandMap.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/CommandMap.kt
deleted file mode 100644
index 4ff41e81c..000000000
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/CommandMap.kt
+++ /dev/null
@@ -1,8 +0,0 @@
-package io.github.freya022.botcommands.api.commands.application
-
-import io.github.freya022.botcommands.api.commands.CommandPath
-
-/**
- * Map of command paths to their application command
- */
-interface CommandMap : Map
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/builder/TopLevelApplicationCommandBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/builder/TopLevelApplicationCommandBuilder.kt
index 02a3915c9..3a654930f 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/builder/TopLevelApplicationCommandBuilder.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/builder/TopLevelApplicationCommandBuilder.kt
@@ -1,31 +1,16 @@
package io.github.freya022.botcommands.api.commands.application.builder
-import io.github.freya022.botcommands.api.commands.application.CommandScope
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.options.builder.ApplicationCommandOptionAggregateBuilder
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandManager
import io.github.freya022.botcommands.api.commands.application.provider.GuildApplicationCommandManager
import io.github.freya022.botcommands.api.commands.application.slash.annotations.TopLevelSlashCommandData
-import io.github.freya022.botcommands.api.core.utils.enumSetOf
import net.dv8tion.jda.api.Permission
import net.dv8tion.jda.api.interactions.IntegrationType
import net.dv8tion.jda.api.interactions.InteractionContextType
-import java.util.*
interface TopLevelApplicationCommandBuilder> : ApplicationCommandBuilder {
- /**
- * @see TopLevelSlashCommandData.scope
- * @see JDAUserCommand.scope
- * @see JDAMessageCommand.scope
- */
- @Deprecated("Replaced with interaction contexts")
- val scope: CommandScope
- get() = when (EnumSet.copyOf(contexts)) {
- enumSetOf(InteractionContextType.GUILD) -> CommandScope.GUILD
- enumSetOf(InteractionContextType.GUILD, InteractionContextType.BOT_DM) -> CommandScope.GLOBAL
- else -> throw IllegalArgumentException("Cannot map $contexts to a CommandScope")
- }
/**
* Represents where a command can be used.
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/MessageCommandInfo.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/MessageCommandInfo.kt
index bf09b6af5..a47d70075 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/MessageCommandInfo.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/MessageCommandInfo.kt
@@ -15,9 +15,4 @@ interface MessageCommandInfo : TopLevelApplicationCommandInfo, ApplicationComman
override val discordOptions: List
get() = parameters.flatMap { it.allOptions }.filterIsInstance()
-
- @Suppress("DeprecatedCallableAddReplaceWith")
- @Deprecated("For removal, confusing on whether it searches nested parameters, prefer using collection operations on 'parameters' instead, make an extension or an utility method")
- override fun getParameter(declaredName: String): MessageContextCommandParameter? =
- parameters.find { it.name == declaredName }
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandOption.kt
index ecc414be7..2a2bbf02d 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandOption.kt
@@ -7,8 +7,6 @@ import io.github.freya022.botcommands.api.commands.application.context.options.C
*/
interface MessageContextCommandOption : ContextCommandOption {
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command get() = executable
override val executable get() = parent.executable
override val parent: MessageContextCommandParameter
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandParameter.kt
index 070587de5..caac58915 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/message/options/MessageContextCommandParameter.kt
@@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.application.context.options.C
interface MessageContextCommandParameter : ContextCommandParameter {
override val nestedAggregatedParameters: List
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command: MessageCommandInfo get() = executable
override val executable: MessageCommandInfo
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/UserCommandInfo.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/UserCommandInfo.kt
index 97f97d2c4..90e625e9a 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/UserCommandInfo.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/UserCommandInfo.kt
@@ -15,9 +15,4 @@ interface UserCommandInfo : TopLevelApplicationCommandInfo, ApplicationCommandIn
override val discordOptions: List
get() = parameters.flatMap { it.allOptions }.filterIsInstance()
-
- @Suppress("DeprecatedCallableAddReplaceWith")
- @Deprecated("For removal, confusing on whether it searches nested parameters, prefer using collection operations on 'parameters' instead, make an extension or an utility method")
- override fun getParameter(declaredName: String): UserContextCommandParameter? =
- parameters.find { it.name == declaredName }
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandOption.kt
index b47bf04e2..ea997a47a 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandOption.kt
@@ -7,8 +7,6 @@ import io.github.freya022.botcommands.api.commands.application.context.options.C
*/
interface UserContextCommandOption : ContextCommandOption {
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command get() = executable
override val executable get() = parent.executable
override val parent: UserContextCommandParameter
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandParameter.kt
index 2652c5476..bdc3cab27 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/context/user/options/UserContextCommandParameter.kt
@@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.application.context.user.User
interface UserContextCommandParameter : ContextCommandParameter {
override val nestedAggregatedParameters: List
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command: UserCommandInfo get() = executable
override val executable: UserCommandInfo
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/diff/DiffEngine.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/diff/DiffEngine.kt
index e4a668ca1..44502a6e6 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/diff/DiffEngine.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/diff/DiffEngine.kt
@@ -3,8 +3,6 @@ package io.github.freya022.botcommands.api.commands.application.diff
import io.github.freya022.botcommands.api.core.config.application.cache.ApplicationCommandsCacheConfig
import io.github.freya022.botcommands.internal.commands.application.diff.ApplicationCommandDiffEngine
import io.github.freya022.botcommands.internal.commands.application.diff.NewApplicationCommandDiffEngine
-import io.github.freya022.botcommands.internal.commands.application.diff.OldApplicationCommandDiffEngine
-import io.github.freya022.botcommands.internal.commands.application.diff.OldRefactoredApplicationCommandDiffEngine
/**
* Represents predefined implementation of an application command diff engine.
@@ -12,18 +10,6 @@ import io.github.freya022.botcommands.internal.commands.application.diff.OldRefa
* @see ApplicationCommandsCacheConfig.diffEngine
*/
enum class DiffEngine(@get:JvmSynthetic internal val instance: ApplicationCommandDiffEngine) {
- /**
- * Good ol' engine.
- */
- @Deprecated(message = "Only use this if there is a bug with the new engine, may be removed in a future release.")
- OLD(OldApplicationCommandDiffEngine),
-
- /**
- * Provides even more logs.
- */
- @Deprecated(message = "Only use this if there is a bug with the new engine, may be removed in a future release.")
- OLD_REFACTORED(OldRefactoredApplicationCommandDiffEngine),
-
/**
* Cleaner logs with what exactly changed.
*/
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandOption.kt
index d5070dd8d..767a8d6e6 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandOption.kt
@@ -7,8 +7,6 @@ import io.github.freya022.botcommands.api.commands.options.CommandOption
*/
interface ApplicationCommandOption : CommandOption {
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command get() = executable
override val executable get() = parent.executable
override val parent: ApplicationCommandParameter
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandParameter.kt
index 1d480c32f..1177a67b5 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/options/ApplicationCommandParameter.kt
@@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.options.CommandParameter
interface ApplicationCommandParameter : CommandParameter {
override val nestedAggregatedParameters: List
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command: ApplicationCommandInfo get() = executable
override val executable: ApplicationCommandInfo
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/provider/AbstractApplicationCommandManager.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/provider/AbstractApplicationCommandManager.kt
index 9c252ba73..2a549820e 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/provider/AbstractApplicationCommandManager.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/provider/AbstractApplicationCommandManager.kt
@@ -18,7 +18,6 @@ import io.github.freya022.botcommands.api.commands.application.slash.builder.Top
import io.github.freya022.botcommands.api.core.BContext
import io.github.freya022.botcommands.api.core.entities.InputUser
import io.github.freya022.botcommands.api.core.setCallerAsDeclarationSite
-import io.github.freya022.botcommands.api.core.utils.enumSetOf
import io.github.freya022.botcommands.api.core.utils.simpleNestedName
import io.github.freya022.botcommands.internal.commands.application.NamedCommandMap
import io.github.freya022.botcommands.internal.commands.application.context.message.MessageCommandInfoImpl
@@ -84,15 +83,6 @@ sealed class AbstractApplicationCommandManager(val context: BContext) {
.also(slashCommandMap::putNewCommand)
}
- @Deprecated(message = "Use overload without CommandScope, optionally set the interaction contexts in the builder")
- fun slashCommand(name: String, scope: CommandScope = defaultScope, function: KFunction?, builder: TopLevelSlashCommandBuilder.() -> Unit) {
- return slashCommand(name, function) {
- contexts = scope.toInteractionContexts()
-
- builder()
- }
- }
-
/**
* Declares the supplied function as a user context command.
*
@@ -124,15 +114,6 @@ sealed class AbstractApplicationCommandManager(val context: BContext) {
.also(userContextCommandMap::putNewCommand)
}
- @Deprecated(message = "Use overload without CommandScope, optionally set the interaction contexts in the builder")
- fun userCommand(name: String, scope: CommandScope = defaultScope, function: KFunction, builder: UserCommandBuilder.() -> Unit) {
- return userCommand(name, function) {
- contexts = scope.toInteractionContexts()
-
- builder()
- }
- }
-
/**
* Declares the supplied function as a message context command.
*
@@ -163,21 +144,6 @@ sealed class AbstractApplicationCommandManager(val context: BContext) {
.also(messageContextCommandMap::putNewCommand)
}
- @Deprecated(message = "Use overload without CommandScope, optionally set the interaction contexts in the builder")
- fun messageCommand(name: String, scope: CommandScope = defaultScope, function: KFunction, builder: MessageCommandBuilder.() -> Unit) {
- return messageCommand(name, function) {
- contexts = scope.toInteractionContexts()
-
- builder()
- }
- }
-
- @Suppress("DEPRECATION")
- private fun CommandScope.toInteractionContexts(): Set = when (this) {
- CommandScope.GUILD, CommandScope.GLOBAL_NO_DM -> enumSetOf(InteractionContextType.GUILD)
- CommandScope.GLOBAL -> enumSetOf(InteractionContextType.GUILD, InteractionContextType.BOT_DM)
- }
-
private fun areContextsValid(contexts: Set): Boolean =
contexts.all { it in supportedContexts }
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/SlashCommandInfo.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/SlashCommandInfo.kt
index 4b4312afb..19c18a138 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/SlashCommandInfo.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/SlashCommandInfo.kt
@@ -29,11 +29,6 @@ interface SlashCommandInfo : ApplicationCommandInfo {
*/
val asMention: String get() = "$fullCommandName:${topLevelInstance.id}>"
- @Suppress("DeprecatedCallableAddReplaceWith")
- @Deprecated("For removal, confusing on whether it searches nested parameters, prefer using collection operations on 'parameters' instead, make an extension or an utility method")
- override fun getParameter(declaredName: String): SlashCommandParameter? =
- parameters.find { it.name == declaredName }
-
/**
* Returns the option with the supplied *display name* (i.e., the name you see on Discord),
* or `null` if not found.
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/AutocompleteCacheMode.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/AutocompleteCacheMode.kt
deleted file mode 100644
index 33edfd882..000000000
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/AutocompleteCacheMode.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.github.freya022.botcommands.api.commands.application.slash.autocomplete
-
-import org.jetbrains.annotations.ApiStatus.ScheduledForRemoval
-
-@Deprecated("Only had one mode ever, that always has been and will still be the default")
-@ScheduledForRemoval
-enum class AutocompleteCacheMode {
- /**
- *
- * The autocomplete choice list will be computed for each **new** key
- *
- * **The value is assumed to always be the same at any point in time, for the same key**, as `f(key, t) = value(key)`
- *
- * The values may be computed if the key has been evicted
- */
- CONSTANT_BY_KEY
-}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/annotations/CacheAutocomplete.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/annotations/CacheAutocomplete.kt
index 9ae3072f6..c2b4be3a8 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/annotations/CacheAutocomplete.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/annotations/CacheAutocomplete.kt
@@ -1,12 +1,9 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.commands.application.slash.autocomplete.annotations
import io.github.freya022.botcommands.api.commands.application.slash.annotations.SlashOption
-import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.AutocompleteCacheMode
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.builder.AutocompleteCacheInfoBuilder
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.builder.AutocompleteInfoBuilder
-import io.github.freya022.botcommands.api.core.config.BConfigBuilder
+import io.github.freya022.botcommands.api.core.config.BApplicationConfig
import net.dv8tion.jda.api.entities.Guild
import net.dv8tion.jda.api.entities.User
import net.dv8tion.jda.api.entities.channel.Channel
@@ -14,7 +11,7 @@ import net.dv8tion.jda.api.entities.channel.Channel
/**
* Enables autocomplete caching.
*
- * By default, this will cache results by key, which is the input of the focused option.
+ * This will cache results by key, which is the input of the focused option.
* However, you can use composite keys if you want to cache based off multiple option values,
* see [compositeKeys] for more details.
*
@@ -27,23 +24,13 @@ import net.dv8tion.jda.api.entities.channel.Channel
@Retention(AnnotationRetention.RUNTIME)
annotation class CacheAutocomplete(
/**
- * Sets the [autocomplete cache mode][AutocompleteCacheMode].
- *
- * Tip: You can mark app options your autocomplete depends on as composite keys,
- * this would be useful to make an autocomplete result depend on multiple options,
- * instead of only the focused one.
- */
- @Deprecated("Only had one mode ever, that always has been and will still be the default", ReplaceWith("cache(block)"))
- val cacheMode: AutocompleteCacheMode = AutocompleteCacheMode.CONSTANT_BY_KEY,
-
- /**
- * Whether the cache should be used even if [autocomplete cache is disabled][BConfigBuilder.disableAutocompleteCache].
+ * Whether the cache should be used even if [autocomplete cache is disabled][BApplicationConfig.disableAutocompleteCache].
*
* This could be useful if your autocomplete is heavy even in a development environment.
*
* @return `true` if the autocomplete results should be cached anyway
*
- * @see BConfigBuilder.disableAutocompleteCache
+ * @see BApplicationConfig.disableAutocompleteCache
* @see AutocompleteCacheInfoBuilder.forceCache
*/
val forceCache: Boolean = false,
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteCacheInfoBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteCacheInfoBuilder.kt
index aa9cb240f..afa8c7162 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteCacheInfoBuilder.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteCacheInfoBuilder.kt
@@ -1,16 +1,15 @@
package io.github.freya022.botcommands.api.commands.application.slash.autocomplete.builder
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.annotations.CacheAutocomplete
-import io.github.freya022.botcommands.api.core.config.BConfig
-import io.github.freya022.botcommands.api.core.config.BConfigBuilder
+import io.github.freya022.botcommands.api.core.config.BApplicationConfig
interface AutocompleteCacheInfoBuilder {
/**
- * Whether the cache should be used even if [autocomplete cache is disabled][BConfig.disableAutocompleteCache].
+ * Whether the cache should be used even if [autocomplete cache is disabled][BApplicationConfig.disableAutocompleteCache].
*
* This could be useful if your autocomplete is heavy even in a development environment.
*
- * @see BConfigBuilder.disableAutocompleteCache
+ * @see BApplicationConfig.disableAutocompleteCache
* @see CacheAutocomplete.forceCache
*/
var forceCache: Boolean
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteInfoBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteInfoBuilder.kt
index ca59ccd21..3251752e5 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteInfoBuilder.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/autocomplete/builder/AutocompleteInfoBuilder.kt
@@ -1,8 +1,5 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.commands.application.slash.autocomplete.builder
-import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.AutocompleteCacheMode
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.AutocompleteMode
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.annotations.AutocompleteHandler
import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.annotations.CacheAutocomplete
@@ -40,17 +37,5 @@ interface AutocompleteInfoBuilder : IDeclarationSiteHolderBuilder {
* @see CacheAutocomplete @CacheAutocomplete
*/
fun cache(block: AutocompleteCacheInfoBuilder.() -> Unit = {})
-
- /**
- * Sets up autocomplete caching.
- *
- * By default, this will cache results by key, which is the input of the focused option.
- * However, you can use composite keys if you want to cache based off multiple option values,
- * see [AutocompleteCacheInfoBuilder.compositeKeys] for more details.
- *
- * @see CacheAutocomplete @CacheAutocomplete
- */
- @Deprecated("Only had one mode ever, that always has been and will still be the default", ReplaceWith("cache(block)"))
- fun cache(cacheMode: AutocompleteCacheMode, block: AutocompleteCacheInfoBuilder.() -> Unit = {}) = cache(block)
}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandOption.kt
index b0e03588f..7908389fc 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandOption.kt
@@ -12,8 +12,6 @@ import net.dv8tion.jda.api.interactions.commands.OptionType
*/
interface SlashCommandOption : ApplicationCommandOption {
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command get() = executable
override val executable get() = parent.executable
override val parent: SlashCommandParameter
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandParameter.kt
index 6ff4253da..f89f1f7b6 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/application/slash/options/SlashCommandParameter.kt
@@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.application.slash.SlashComman
interface SlashCommandParameter : ApplicationCommandParameter {
override val nestedAggregatedParameters: List
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command: SlashCommandInfo get() = executable
override val executable: SlashCommandInfo
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandOption.kt
index 063cd895b..a2a4a4657 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandOption.kt
@@ -1,16 +1,11 @@
package io.github.freya022.botcommands.api.commands.options
-import io.github.freya022.botcommands.api.core.Executable
import io.github.freya022.botcommands.api.core.options.Option
/**
* Represents a Discord input of a command.
*/
interface CommandOption : Option {
- /**
- * The executable command this parameter is from.
- */
- @Deprecated("Renamed to 'executable'", ReplaceWith("executable"))
- val command: Executable get() = executable
+
override val parent: CommandParameter
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandParameter.kt
index 464be14ea..fc7e08c44 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/options/CommandParameter.kt
@@ -1,17 +1,9 @@
package io.github.freya022.botcommands.api.commands.options
-import io.github.freya022.botcommands.api.core.Executable
import io.github.freya022.botcommands.api.parameters.AggregatedParameter
/**
* Represents a command parameter,
* which has its value computed by an aggregation function, from one or more options.
*/
-interface CommandParameter : AggregatedParameter {
- /**
- * The executable command this parameter is from.
- */
- @Deprecated("Renamed to 'executable'", ReplaceWith("executable"))
- val command: Executable
- get() = executable
-}
\ No newline at end of file
+interface CommandParameter : AggregatedParameter
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandVariation.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandVariation.kt
index e26ea3d4e..507da4163 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandVariation.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandVariation.kt
@@ -62,11 +62,6 @@ interface TextCommandVariation : Executable, IDeclarationSiteHolder,
*/
val completePattern: Regex?
- @Suppress("DeprecatedCallableAddReplaceWith")
- @Deprecated("For removal, confusing on whether it searches nested parameters, prefer using collection operations on 'parameters' instead, make an extension or an utility method")
- override fun getParameter(declaredName: String): TextCommandParameter? =
- parameters.find { it.name == declaredName }
-
/**
* Returns the option with the supplied *display name* (i.e., the name you see on the built-in help command),
* or `null` if not found.
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandsContext.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandsContext.kt
index 6f4f15c35..77397f781 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandsContext.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/TextCommandsContext.kt
@@ -16,44 +16,6 @@ interface TextCommandsContext {
val rootCommands: Collection
- /**
- * Returns the full list of prefixes used to trigger the bot.
- *
- * This does not include ping-as-prefix.
- *
- * @return Full list of prefixes
- */
- @Deprecated(
- message = "Read directly on BTextConfig if necessary, this property doesn't mean the bot always responds to these prefixes",
- replaceWith = ReplaceWith(expression = "textConfig.prefixes")
- )
- val prefixes: List
- get() = textConfig.prefixes
-
- /**
- * @return `true` if the bot responds to its own mention.
- */
- @Deprecated(
- message = "Read directly on BTextConfig if necessary, this property doesn't mean the bot always responds to pings",
- replaceWith = ReplaceWith(expression = "textConfig.usePingAsPrefix")
- )
- val isPingAsPrefix: Boolean
- get() = textConfig.usePingAsPrefix
-
- /**
- * Returns the preferred prefix for triggering this bot,
- * or `null` if [BTextConfig.usePingAsPrefix] is disabled and no prefix was added in [BTextConfig.prefixes].
- */
- @Deprecated(
- message = "Now requires a GuildMessageChannel",
- replaceWith = ReplaceWith(expression = "this.getPreferredPrefix(channel)")
- )
- @Suppress("DEPRECATION")
- fun getPreferredPrefix(jda: JDA): String? = when {
- isPingAsPrefix -> jda.selfUser.asMention + " "
- else -> prefixes.firstOrNull()
- }
-
/**
* Returns the [configured prefixes][BTextConfig.prefixes] and the [bot mention][BTextConfig.usePingAsPrefix] if enabled.
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandOption.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandOption.kt
index 84b533923..047015926 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandOption.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandOption.kt
@@ -9,8 +9,6 @@ import io.github.freya022.botcommands.api.parameters.resolvers.TextParameterReso
*/
interface TextCommandOption : CommandOption {
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command get() = executable
override val executable get() = parent.executable
override val parent: TextCommandParameter
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandParameter.kt b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandParameter.kt
index c16c46308..a76c1880f 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandParameter.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/commands/text/options/TextCommandParameter.kt
@@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.text.TextCommandVariation
interface TextCommandParameter : CommandParameter {
override val nestedAggregatedParameters: List
- @Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
- override val command: TextCommandVariation get() = executable
override val executable: TextCommandVariation
}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/Components.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/Components.kt
index 418ce11a4..7f61c6f17 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/Components.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/components/Components.kt
@@ -48,40 +48,6 @@ import java.time.Duration as JavaDuration
@RequiresComponents
class Components internal constructor(componentController: ComponentController) : AbstractComponentFactory(componentController) {
companion object {
- /**
- * The default timeout for *ephemeral* components and component groups.
- *
- * `null`, non-positive and infinite durations are considered as a disabled timeout.
- */
- @Deprecated("Renamed to defaultEphemeralTimeout", ReplaceWith("this.defaultEphemeralTimeout"))
- var defaultTimeout: Duration
- @JvmSynthetic
- get() = defaultEphemeralTimeout!!
- @JvmSynthetic
- set(value) {
- defaultEphemeralTimeout = value
- }
-
- /**
- * The default timeout for *ephemeral* components and component groups.
- *
- * `null`, non-positive and infinite durations are considered as a disabled timeout.
- */
- @JvmStatic
- @Deprecated("Renamed to getDefaultTimeout", ReplaceWith("this.getDefaultTimeout()"))
- fun getDefaultTimeout(): JavaDuration = defaultEphemeralTimeout!!.toJavaDuration()
-
- /**
- * Sets the default timeout for *ephemeral* components and component groups.
- *
- * `null`, non-positive and infinite durations are considered as a disabled timeout.
- */
- @JvmStatic
- @Deprecated("Renamed to setDefaultTimeout", ReplaceWith("this.setDefaultTimeout(timeout)"))
- fun setDefaultTimeout(timeout: JavaDuration) {
- defaultEphemeralTimeout = timeout.toKotlinDuration()
- }
-
/**
* The default timeout for ephemeral components and component groups.
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/EphemeralHandlerBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/EphemeralHandlerBuilder.kt
deleted file mode 100644
index 51971c0c8..000000000
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/EphemeralHandlerBuilder.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package io.github.freya022.botcommands.api.components.builder
-
-import io.github.freya022.botcommands.internal.components.ComponentDSL
-import io.github.freya022.botcommands.internal.components.handler.EphemeralHandler
-import net.dv8tion.jda.api.events.interaction.component.GenericComponentInteractionCreateEvent
-
-@Deprecated("Nothing to be configured, will be removed")
-@ComponentDSL
-class EphemeralHandlerBuilder internal constructor(val handler: suspend (E) -> Unit) {
- @JvmSynthetic
- internal fun build(): EphemeralHandler {
- return EphemeralHandler(handler)
- }
-}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IActionableComponent.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IActionableComponent.kt
index 729869cb2..39b38260e 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IActionableComponent.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IActionableComponent.kt
@@ -1,9 +1,6 @@
-@file:Suppress("DEPRECATION")
-
package io.github.freya022.botcommands.api.components.builder
import dev.minn.jda.ktx.util.ref
-import io.github.freya022.botcommands.api.ReceiverConsumer
import io.github.freya022.botcommands.api.commands.annotations.RateLimitReference
import io.github.freya022.botcommands.api.commands.ratelimit.declaration.RateLimitProvider
import io.github.freya022.botcommands.api.components.ComponentInteractionFilter
@@ -130,17 +127,7 @@ interface IPersistentActionableComponent>
* @param data The data to pass to the component handler
*/
@CheckReturnValue
- fun bindTo(handlerName: String, data: List): T = bindTo(handlerName) { passData(data) }
-
- /**
- * Binds the given handler name with its arguments to this component.
- *
- * @param handlerName The name of the handler to run when the button is clicked,
- * defined by either [JDAButtonListener] or [JDASelectMenuListener]
- */
- @Deprecated("Nothing else to be configured than the data, will be removed, pass your data to bindTo directly")
- @CheckReturnValue
- fun bindTo(handlerName: String, block: ReceiverConsumer): T
+ fun bindTo(handlerName: String, data: List): T
}
/**
@@ -161,19 +148,6 @@ interface IEphemeralActionableComponent,
@CheckReturnValue
fun bindTo(handler: Consumer): T = bindTo(handler = { handler.accept(it) })
- /**
- * Binds the given handler to this component.
- *
- * ### Captured entities
- * Pay *extra* attention to not capture JDA entities in such handlers
- * as [they can stop being updated by JDA](https://jda.wiki/using-jda/troubleshooting/#cannot-get-reference-as-it-has-already-been-garbage-collected).
- *
- * @param handler The handler to run when the button is clicked
- */
- @Deprecated("Nothing to be configured, will be removed", ReplaceWith("bindTo(handler)"))
- @CheckReturnValue
- fun bindTo(handler: Consumer, block: ReceiverConsumer>): T = bindTo(handler = { handler.accept(it) }, block)
-
/**
* Binds the given handler to this component.
*
@@ -187,393 +161,7 @@ interface IEphemeralActionableComponent,
* @param handler The handler to run when the button is clicked
*/
@JvmSynthetic
- fun bindTo(handler: suspend (E) -> Unit): T = bindTo(handler, ReceiverConsumer.noop())
-
- /**
- * Binds the given handler to this component.
- *
- * ### Captured entities
- * Pay *extra* attention to not capture JDA entities in such handlers
- * as [they can stop being updated by JDA](https://jda.wiki/using-jda/troubleshooting/#cannot-get-reference-as-it-has-already-been-garbage-collected).
- *
- * You can still use [User.ref] and such from JDA-KTX to attenuate this issue,
- * even though it will return you an outdated object if the entity cannot be found anymore.
- *
- * @param handler The handler to run when the button is clicked
- */
- @Deprecated("Nothing to be configured, will be removed", ReplaceWith("bindTo(handler)"))
- @JvmSynthetic
- fun bindTo(handler: suspend (E) -> Unit, block: ReceiverConsumer>): T
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func)"))
-fun , E : GenericComponentInteractionCreateEvent> T.bindTo(func: KSuspendFunction1, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, emptyList(), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func)"))
-fun , E : GenericComponentInteractionCreateEvent> T.bindTo(func: KFunction1, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, emptyList(), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1)"))
-fun , E : GenericComponentInteractionCreateEvent, T1> T.bindTo(func: KSuspendFunction2, arg1: T1, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1)"))
-fun , E : GenericComponentInteractionCreateEvent, T1> T.bindTo(func: KFunction2, arg1: T1, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2> T.bindTo(func: KSuspendFunction3, arg1: T1, arg2: T2, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2> T.bindTo(func: KFunction3, arg1: T1, arg2: T2, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3> T.bindTo(func: KSuspendFunction4, arg1: T1, arg2: T2, arg3: T3, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3> T.bindTo(func: KFunction4, arg1: T1, arg2: T2, arg3: T3, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4> T.bindTo(func: KSuspendFunction5, arg1: T1, arg2: T2, arg3: T3, arg4: T4, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4> T.bindTo(func: KFunction5, arg1: T1, arg2: T2, arg3: T3, arg4: T4, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5> T.bindTo(func: KSuspendFunction6, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5> T.bindTo(func: KFunction6, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6> T.bindTo(func: KSuspendFunction7, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6> T.bindTo(func: KFunction7, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7> T.bindTo(func: KSuspendFunction8, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7> T.bindTo(func: KFunction8, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8> T.bindTo(func: KSuspendFunction9, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8> T.bindTo(func: KFunction9, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8, T9> T.bindTo(func: KSuspendFunction10, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8, T9> T.bindTo(func: KFunction10, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@JvmName("bindToSuspend")
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> T.bindTo(func: KSuspendFunction11, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), block)
-}
-
-/**
- * Binds the given handler to this component.
- *
- * ### Handler data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
-@Deprecated("Replaced with bindWith", ReplaceWith("bindWith(func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)"))
-fun , E : GenericComponentInteractionCreateEvent, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> T.bindTo(func: KFunction11, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10, block: ReceiverConsumer = ReceiverConsumer.noop()): T {
- return bindToCallable(func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10), block)
-}
-
-private fun > T.bindToCallable(func: KFunction<*>, data: List, block: ReceiverConsumer): T {
- return this.bindTo(findHandlerName(func)) {
- apply(block)
- passData(data)
- }
+ fun bindTo(handler: suspend (E) -> Unit): T
}
/**
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/ITimeoutableComponent.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/ITimeoutableComponent.kt
index 2234dad8f..11c092e69 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/ITimeoutableComponent.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/ITimeoutableComponent.kt
@@ -315,611 +315,6 @@ interface IEphemeralTimeoutableComponent>
fun timeout(timeout: Duration, handler: suspend () -> Unit): T
}
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func)"))
-fun , E : ITimeoutData> T.timeout(duration: Duration, func: KSuspendFunction1): T {
- return timeoutWithBoundCallable(duration, func, emptyList())
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func)"))
-fun , E : ITimeoutData> T.timeout(duration: Duration, func: KFunction1): T {
- return timeoutWithBoundCallable(duration, func, emptyList())
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1)"))
-fun , E : ITimeoutData, T1> T.timeout(duration: Duration, func: KSuspendFunction2, arg1: T1): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1)"))
-fun , E : ITimeoutData, T1> T.timeout(duration: Duration, func: KFunction2, arg1: T1): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2)"))
-fun , E : ITimeoutData, T1, T2> T.timeout(duration: Duration, func: KSuspendFunction3, arg1: T1, arg2: T2): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2)"))
-fun , E : ITimeoutData, T1, T2> T.timeout(duration: Duration, func: KFunction3, arg1: T1, arg2: T2): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3)"))
-fun , E : ITimeoutData, T1, T2, T3> T.timeout(duration: Duration, func: KSuspendFunction4, arg1: T1, arg2: T2, arg3: T3): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3)"))
-fun , E : ITimeoutData, T1, T2, T3> T.timeout(duration: Duration, func: KFunction4, arg1: T1, arg2: T2, arg3: T3): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4)"))
-fun , E : ITimeoutData, T1, T2, T3, T4> T.timeout(duration: Duration, func: KSuspendFunction5, arg1: T1, arg2: T2, arg3: T3, arg4: T4): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4)"))
-fun , E : ITimeoutData, T1, T2, T3, T4> T.timeout(duration: Duration, func: KFunction5, arg1: T1, arg2: T2, arg3: T3, arg4: T4): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5> T.timeout(duration: Duration, func: KSuspendFunction6, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5> T.timeout(duration: Duration, func: KFunction6, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6> T.timeout(duration: Duration, func: KSuspendFunction7, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6> T.timeout(duration: Duration, func: KFunction7, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7> T.timeout(duration: Duration, func: KSuspendFunction8, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7> T.timeout(duration: Duration, func: KFunction8, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8> T.timeout(duration: Duration, func: KSuspendFunction9, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8> T.timeout(duration: Duration, func: KFunction9, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8, T9> T.timeout(duration: Duration, func: KSuspendFunction10, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8, T9> T.timeout(duration: Duration, func: KFunction10, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@JvmName("timeoutSuspend")
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> T.timeout(duration: Duration, func: KSuspendFunction11, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10))
-}
-
-/**
- * Sets the timeout on this component, invalidating the component on expiration,
- * and running the timeout handler with the given name and its arguments.
- *
- * **Note:** Components inside groups cannot have timeouts.
- *
- * ### Timeout cancellation
- * The timeout will be canceled once a component has been deleted,
- * including if the component was set to a [single use][IUniqueComponent.singleUse].
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * ### Timeout data
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [TimeoutParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@TimeoutData][TimeoutData].
- */
-@Deprecated("Replaced with timeoutWith", ReplaceWith("timeoutWith(duration, func, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)"))
-fun , E : ITimeoutData, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> T.timeout(duration: Duration, func: KFunction11, arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10): T {
- return timeoutWithBoundCallable(duration, func, listOf(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10))
-}
-
/**
* Sets the timeout on this component, invalidating the component on expiration,
* and running the timeout handler with the given name and its arguments.
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IUniqueComponent.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IUniqueComponent.kt
index 0ebfbd2b5..0db74e01f 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IUniqueComponent.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/IUniqueComponent.kt
@@ -12,22 +12,6 @@ import javax.annotation.CheckReturnValue
* This will also cause cancellation of any associated timeout.
*/
interface IUniqueComponent> {
- /**
- * Sets this component as being usable once.
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * This will also cause cancellation of any associated timeout.
- */
- @Deprecated(message = "Renamed to 'singleUse'", ReplaceWith("singleUse"))
- var oneUse: Boolean
- get() = singleUse
- set(value) {
- singleUse = value
- }
-
/**
* Sets this component as being usable once.
*
@@ -39,19 +23,6 @@ interface IUniqueComponent> {
*/
var singleUse: Boolean
- /**
- * Sets this component as being usable once.
- *
- * ### Component deletion
- * - If the component is a group, then all of its owned components will also be deleted.
- * - If the component is inside a group, then all the group's components will also be deleted.
- *
- * This will also cause cancellation of any associated timeout.
- */
- @Deprecated(message = "Renamed to 'singleUse'", ReplaceWith("singleUse(oneUse)"))
- @CheckReturnValue
- fun oneUse(oneUse: Boolean): T = singleUse(oneUse)
-
/**
* Sets this component as being usable once.
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/PersistentHandlerBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/PersistentHandlerBuilder.kt
deleted file mode 100644
index f9e9d36b0..000000000
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/builder/PersistentHandlerBuilder.kt
+++ /dev/null
@@ -1,42 +0,0 @@
-package io.github.freya022.botcommands.api.components.builder
-
-import io.github.freya022.botcommands.api.components.annotations.ComponentData
-import io.github.freya022.botcommands.api.parameters.resolvers.ComponentParameterResolver
-import io.github.freya022.botcommands.internal.components.ComponentDSL
-import io.github.freya022.botcommands.internal.components.handler.PersistentHandler
-import net.dv8tion.jda.api.entities.ISnowflake
-
-@Deprecated("Nothing to be configured, will be removed, pass your data to bindTo directly")
-@ComponentDSL
-class PersistentHandlerBuilder internal constructor(val handlerName: String) {
- private var data: List = emptyList()
-
- /**
- * Sets the data passed to the persistent handler's function.
- *
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
- fun passData(data: List) {
- this.data = data
- }
-
- /**
- * Sets the data passed to the persistent handler's function.
- *
- * The data passed is transformed with [toString][Object.toString],
- * except [snowflakes][ISnowflake] which get their IDs stored.
- *
- * The data can only be reconstructed if a [ComponentParameterResolver] exists for the handler's parameter type.
- *
- * Remember the parameters need to be annotated with [@ComponentData][ComponentData].
- */
- fun passData(vararg data: Any?): Unit = passData(data.asList())
-
- @JvmSynthetic
- internal fun build(): PersistentHandler = PersistentHandler.create(handlerName, data)
-}
\ No newline at end of file
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/components/utils/ButtonContent.kt b/src/main/kotlin/io/github/freya022/botcommands/api/components/utils/ButtonContent.kt
index d98e31b05..dc408763c 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/components/utils/ButtonContent.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/components/utils/ButtonContent.kt
@@ -95,48 +95,5 @@ data class ButtonContent(val style: ButtonStyle, val label: String?, val emoji:
fun fromUnicode(style: ButtonStyle, unicode: String): ButtonContent {
return ButtonContent(style, null, Emoji.fromUnicode(unicode), disabled = false)
}
-
- /**
- * Constructs a [ButtonContent] with a label and an unicode emoji,
- * see [Emoji.fromUnicode] for accepted formats.
- *
- * @see jda-emojis
- */
- @JvmStatic
- @Deprecated(
- message = "Prefer using emojis from the jda-emojis library, and pass them to fromEmoji",
- replaceWith = ReplaceWith(expression = "ButtonContent.fromEmoji(style, label, Emojis.)", imports = ["dev.freya02.jda.emojis.unicode.Emojis"])
- )
- fun fromUnicode(style: ButtonStyle, label: String, unicode: String): ButtonContent {
- return ButtonContent(style, label, Emoji.fromUnicode(unicode), disabled = false)
- }
-
- /**
- * Constructs a [ButtonContent] from a shortcode emoji, such as `:joy:`.
- *
- * @see jda-emojis
- */
- @JvmStatic
- @Deprecated(
- message = "Prefer using emojis from the jda-emojis library, and pass them to fromEmoji",
- replaceWith = ReplaceWith(expression = "ButtonContent.fromEmoji(style, Emojis.)", imports = ["dev.freya02.jda.emojis.unicode.Emojis"])
- )
- fun fromShortcode(style: ButtonStyle, shortcode: String): ButtonContent {
- return ButtonContent(style, null, EmojiUtils.resolveJDAEmoji(shortcode), disabled = false)
- }
-
- /**
- * Constructs a [ButtonContent] from a [String] and a shortcode emoji, such as `:joy:`.
- *
- * @see jda-emojis
- */
- @JvmStatic
- @Deprecated(
- message = "Prefer using emojis from the jda-emojis library, and pass them to fromEmoji",
- replaceWith = ReplaceWith(expression = "ButtonContent.fromEmoji(style, text, Emojis.)", imports = ["dev.freya02.jda.emojis.unicode.Emojis"])
- )
- fun fromShortcode(style: ButtonStyle, text: String, shortcode: String): ButtonContent {
- return ButtonContent(style, text, EmojiUtils.resolveJDAEmoji(shortcode), disabled = false)
- }
}
}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/core/BBuilder.kt b/src/main/kotlin/io/github/freya022/botcommands/api/core/BBuilder.kt
deleted file mode 100644
index 5deba3e72..000000000
--- a/src/main/kotlin/io/github/freya022/botcommands/api/core/BBuilder.kt
+++ /dev/null
@@ -1,77 +0,0 @@
-package io.github.freya022.botcommands.api.core
-
-import dev.minn.jda.ktx.events.CoroutineEventManager
-import dev.minn.jda.ktx.events.getDefaultScope
-import io.github.freya022.botcommands.api.ReceiverConsumer
-import io.github.freya022.botcommands.api.commands.annotations.Command
-import io.github.freya022.botcommands.api.core.config.BConfigBuilder
-import io.github.freya022.botcommands.api.core.service.annotations.BService
-import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
-import kotlinx.coroutines.cancel
-import net.dv8tion.jda.api.events.session.ShutdownEvent
-import kotlin.time.Duration.Companion.minutes
-
-/**
- * Entry point for the BotCommands framework.
- *
- * The only requirement for a basic bot is a service extending [JDAService],
- * learn more on [the wiki](https://bc.freya02.dev/3.X/setup/getting-started/#creating-a-jdaservice).
- *
- * @see BService @BService
- * @see InterfacedService @InterfacedService
- * @see Command @Command
- */
-@Suppress("DEPRECATION")
-@Deprecated("Replaced with the BotCommands entry point")
-class BBuilder private constructor() {
- /**
- * Entry point for the BotCommands framework.
- *
- * @see BBuilder
- */
- companion object {
- /**
- * Creates a new instance of the framework.
- *
- * @see BBuilder
- */
- @Deprecated(
- "Replaced with the BotCommands entry point",
- replaceWith = ReplaceWith(
- expression = "BotCommands.create(configConsumer)",
- imports = ["io.github.freya022.botcommands.api.core.BotCommands"]
- )
- )
- @JvmStatic
- @JvmName("newBuilder")
- fun newBuilderJava(configConsumer: ReceiverConsumer): BContext {
- return BotCommands.create(configConsumer = configConsumer)
- }
-
- /**
- * Creates a new instance of the framework.
- *
- * @see BBuilder
- */
- @Deprecated(
- "Replaced with the BotCommands entry point",
- replaceWith = ReplaceWith(
- expression = "BotCommands.create(manager, configConsumer)",
- imports = ["io.github.freya022.botcommands.api.core.BotCommands"]
- )
- )
- @JvmSynthetic
- fun newBuilder(manager: CoroutineEventManager = getDefaultManager(), configConsumer: ReceiverConsumer): BContext {
- return BotCommands.create(manager, configConsumer)
- }
-
- private fun getDefaultManager(): CoroutineEventManager {
- val scope = getDefaultScope()
- return CoroutineEventManager(scope, 1.minutes).apply {
- listener {
- scope.cancel()
- }
- }
- }
- }
-}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/core/BContext.kt b/src/main/kotlin/io/github/freya022/botcommands/api/core/BContext.kt
index b81e07d8b..0f6979c00 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/core/BContext.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/core/BContext.kt
@@ -1,9 +1,6 @@
package io.github.freya022.botcommands.api.core
import io.github.freya022.botcommands.api.commands.application.ApplicationCommandsContext
-import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.annotations.AutocompleteHandler
-import io.github.freya022.botcommands.api.commands.application.slash.autocomplete.declaration.AutocompleteManager
-import io.github.freya022.botcommands.api.commands.text.HelpBuilderConsumer
import io.github.freya022.botcommands.api.commands.text.TextCommandsContext
import io.github.freya022.botcommands.api.core.config.*
import io.github.freya022.botcommands.api.core.events.*
@@ -12,15 +9,8 @@ import io.github.freya022.botcommands.api.core.service.ServiceContainer
import io.github.freya022.botcommands.api.core.service.ServiceResult
import io.github.freya022.botcommands.api.core.service.annotations.InterfacedService
import io.github.freya022.botcommands.api.core.service.getService
-import io.github.freya022.botcommands.api.localization.DefaultMessages
-import io.github.freya022.botcommands.api.localization.DefaultMessagesFactory
import io.github.freya022.botcommands.internal.core.exceptions.ServiceException
import net.dv8tion.jda.api.JDA
-import net.dv8tion.jda.api.entities.Guild
-import net.dv8tion.jda.api.entities.UserSnowflake
-import net.dv8tion.jda.api.interactions.DiscordLocale
-import net.dv8tion.jda.api.interactions.Interaction
-import kotlin.reflect.KFunction
/**
* Main context for BotCommands framework.
@@ -66,10 +56,6 @@ interface BContext {
get() = config.componentsConfig
val coroutineScopesConfig: BCoroutineScopesConfig
get() = config.coroutineScopesConfig
- @Suppress("DEPRECATION")
- @Deprecated("For removal", replaceWith = ReplaceWith(""))
- val debugConfig: BDebugConfig
- get() = config.debugConfig
val serviceConfig: BServiceConfig
get() = config.serviceConfig
val appEmojisConfig: BAppEmojisConfig
@@ -124,25 +110,6 @@ interface BContext {
*/
val botOwners: BotOwners
- /**
- * Returns the IDs of the bot owners.
- *
- * @see BotOwners.ownerIds
- */
- @Deprecated(
- message = "Get from BotOwners directly",
- replaceWith = ReplaceWith("botOwners.ownerIds")
- )
- val ownerIds: Collection get() = botOwners.ownerIds
-
- /**
- * Returns the [SettingsProvider] service, or `null` if none exists.
- *
- * @see SettingsProvider
- */
- @Suppress("removal", "DEPRECATION")
- val settingsProvider: SettingsProvider?
-
/**
* Returns the [global exception handler][GlobalExceptionHandler],
* used to handle errors caught by the framework, or `null` if none exists.
@@ -151,79 +118,6 @@ interface BContext {
*/
val globalExceptionHandler: GlobalExceptionHandler?
- /**
- * Tells whether this user is an owner or not.
- *
- * @param userId ID of the user
- *
- * @return `true` if the user is an owner
- */
- @Deprecated(
- message = "Prefer using BotOwners#isOwner/contains",
- replaceWith = ReplaceWith(
- expression = "UserSnowflake.fromId(userId) in botOwners",
- imports = ["net.dv8tion.jda.api.entities.UserSnowflake"]
- )
- )
- fun isOwner(userId: Long): Boolean = UserSnowflake.fromId(userId) in botOwners
-
- /**
- * Returns the [DefaultMessages] instance for the provided Discord locale.
- *
- * @param locale The locale to get the messages in
- */
- @Deprecated(
- message = "Get from DefaultMessagesFactory",
- replaceWith = ReplaceWith(
- expression = "this.getService().get(locale.toLocale())",
- imports = [
- "io.github.freya022.botcommands.api.localization.DefaultMessagesFactory",
- "io.github.freya022.botcommands.api.core.service.getService"
- ]
- )
- )
- fun getDefaultMessages(locale: DiscordLocale): DefaultMessages =
- getService().get(locale.toLocale())
-
- /**
- * Returns the [DefaultMessages] instance for this Guild's locale
- *
- * @param guild The Guild to take the locale from
- */
- @Deprecated(
- message = "Get from DefaultMessagesFactory, using the message event",
- replaceWith = ReplaceWith(
- expression = "this.getService().get(event)",
- imports = [
- "io.github.freya022.botcommands.api.localization.DefaultMessagesFactory",
- "io.github.freya022.botcommands.api.core.service.getService"
- ]
- )
- )
- @Suppress("DEPRECATION")
- fun getDefaultMessages(guild: Guild?): DefaultMessages {
- return getService().get(getEffectiveLocale(guild).toLocale())
- }
-
- /**
- * Returns the [DefaultMessages] instance for this user's locale
- *
- * @param interaction The Interaction to take the user's locale from
- */
- @Deprecated(
- message = "Get from DefaultMessagesFactory",
- replaceWith = ReplaceWith(
- expression = "this.getService().get(interaction)",
- imports = [
- "io.github.freya022.botcommands.api.localization.DefaultMessagesFactory",
- "io.github.freya022.botcommands.api.core.service.getService"
- ]
- )
- )
- fun getDefaultMessages(interaction: Interaction): DefaultMessages {
- return getService().get(interaction)
- }
-
/**
* Sends an exception message to the [bot owners][BotOwners].
*
@@ -250,26 +144,6 @@ interface BContext {
*/
fun getExceptionContent(message: String, t: Throwable?, extraContext: Map): String
- /**
- * Returns the [DiscordLocale] for the specified [Guild]
- *
- * @param guild The [Guild] in which to take the [DiscordLocale] from
- *
- * @return The [DiscordLocale] of the [Guild]
- */
- @Suppress("DEPRECATION")
- @Deprecated("Replaced with TextCommandLocaleProvider")
- fun getEffectiveLocale(guild: Guild?): DiscordLocale {
- if (guild != null && guild.features.contains("COMMUNITY")) {
- return guild.locale
- }
-
- return settingsProvider?.getLocale(guild)
- //Discord default
- ?: return DiscordLocale.ENGLISH_US
- }
-
- //region Text commands
/**
* Returns the [TextCommandsContext] service.
*
@@ -277,101 +151,10 @@ interface BContext {
*/
val textCommandsContext: TextCommandsContext
- /**
- * Returns the full list of prefixes used to trigger the bot.
- *
- * This does not include ping-as-prefix.
- *
- * @return Full list of prefixes
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.prefixes"))
- val prefixes: List
- @Suppress("DEPRECATION")
- get() = textCommandsContext.prefixes
-
- /**
- * @return `true` if the bot responds to its own mention.
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.isPingAsPrefix"))
- val isPingAsPrefix: Boolean
- @Suppress("DEPRECATION")
- get() = textCommandsContext.isPingAsPrefix
-
- /**
- * Returns the preferred prefix for triggering this bot,
- * or `null` if [BTextConfig.usePingAsPrefix] is disabled and no prefix was added in [BTextConfig.prefixes].
- *
- * @return The preferred prefix
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.getPreferredPrefix(jda)"))
- val prefix: String?
- @Suppress("DEPRECATION")
- get() = textCommandsContext.getPreferredPrefix(jda)
-
- /**
- * Returns the [DefaultEmbedSupplier] service.
- *
- * @see DefaultEmbedSupplier
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.defaultEmbedSupplier"))
- val defaultEmbedSupplier: DefaultEmbedSupplier
- get() = textCommandsContext.defaultEmbedSupplier
-
- /**
- * Returns the [DefaultEmbedFooterIconSupplier] service.
- *
- * @see DefaultEmbedFooterIconSupplier
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.defaultEmbedFooterIconSupplier"))
- val defaultEmbedFooterIconSupplier: DefaultEmbedFooterIconSupplier
- get() = textCommandsContext.defaultEmbedFooterIconSupplier
-
- /**
- * Returns the help builder consumer - changes the EmbedBuilder given to add more stuff in it
- *
- * @return The help builder consumer
- */
- @Deprecated("Moved to TextCommandsContext", ReplaceWith("textCommandsContext.helpBuilderConsumer"))
- val helpBuilderConsumer: HelpBuilderConsumer?
- get() = textCommandsContext.helpBuilderConsumer
- //endregion
-
- //region Application commands
/**
* Returns the application commands context, this is for user/message/slash commands and related methods
*
* @return The [ApplicationCommandsContext] object
*/
val applicationCommandsContext: ApplicationCommandsContext
-
- /**
- * Invalidates the autocomplete cache of the specified autocomplete handler.
- *
- * This means that the cache of this autocomplete handler will be fully cleared.
- *
- * @param autocompleteHandlerName The name of the autocomplete handler,
- * supplied at [AutocompleteHandler.name] or [AutocompleteManager.autocomplete]
- */
- @Deprecated(
- message = "Moved to ApplicationCommandsContext",
- replaceWith = ReplaceWith(expression = "applicationCommandsContext.invalidateAutocompleteCache(autocompleteHandlerName)")
- )
- fun invalidateAutocompleteCache(autocompleteHandlerName: String) =
- applicationCommandsContext.invalidateAutocompleteCache(autocompleteHandlerName)
-
- /**
- * Invalidates the autocomplete cache of the specified autocomplete handler.
- *
- * This means that the cache of this autocomplete handler will be fully cleared.
- *
- * @param autocompleteHandler The autocomplete handler, supplied at [AutocompleteManager.autocomplete]
- */
- @Deprecated(
- message = "Moved to ApplicationCommandsContext",
- replaceWith = ReplaceWith(expression = "applicationCommandsContext.invalidateAutocompleteCache(autocompleteHandler)")
- )
- @JvmSynthetic
- fun invalidateAutocompleteCache(autocompleteHandler: KFunction>) =
- applicationCommandsContext.invalidateAutocompleteCache(autocompleteHandler)
- //endregion
}
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/core/BotCommands.kt b/src/main/kotlin/io/github/freya022/botcommands/api/core/BotCommands.kt
index 974661338..8b0ceba9d 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/core/BotCommands.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/core/BotCommands.kt
@@ -1,6 +1,5 @@
package io.github.freya022.botcommands.api.core
-import dev.minn.jda.ktx.events.CoroutineEventManager
import io.github.freya022.botcommands.api.ReceiverConsumer
import io.github.freya022.botcommands.api.commands.annotations.Command
import io.github.freya022.botcommands.api.core.config.BConfig
@@ -45,22 +44,6 @@ object BotCommands {
return create(configConsumer = configConsumer)
}
- /**
- * Creates a new instance of the framework.
- *
- * @return The context for the newly created framework instance,
- * while this is returned, using it *usually* is not a good idea,
- * your architecture should rely on [dependency injection](https://bc.freya02.dev/3.X/using-botcommands/dependency-injection/)
- * and events instead.
- *
- * @see BotCommands
- */
- @Deprecated("Event manager is set by a service implementing ICoroutineEventManagerSupplier")
- @JvmSynthetic
- fun create(manager: CoroutineEventManager, configConsumer: ReceiverConsumer): BContext {
- return build(BConfigBuilder().apply(configConsumer).build())
- }
-
/**
* Creates a new instance of the framework.
*
diff --git a/src/main/kotlin/io/github/freya022/botcommands/api/core/Executable.kt b/src/main/kotlin/io/github/freya022/botcommands/api/core/Executable.kt
index 6147a06e6..cdb1c11d8 100644
--- a/src/main/kotlin/io/github/freya022/botcommands/api/core/Executable.kt
+++ b/src/main/kotlin/io/github/freya022/botcommands/api/core/Executable.kt
@@ -46,24 +46,6 @@ interface Executable {
val allOptionsOrdered: List