Skip to content

Commit

Permalink
Remove deprecated elements and prepare for beta (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 authored Feb 4, 2025
1 parent be0fded commit ffeff8c
Show file tree
Hide file tree
Showing 99 changed files with 197 additions and 3,209 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -26,9 +23,4 @@ public enum CommandScope {
* <p>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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ 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
*/
@NotNull
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
*/
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<br>
* This returns `null` by default
*
* @see CommandId @CommandId
*/
@Deprecated(message = "Replaced by DeclarationFilter and CommandDeclarationFilter")
open fun getGuildsForCommandId(commandId: String, commandPath: CommandPath): Collection<Long>? {
return null
}

/**
* Returns the generated value supplier of a [@GeneratedOption][GeneratedOption].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ interface ApplicationCommandInfo : CommandInfo, Executable,

override val discordOptions: List<ApplicationCommandOption>

@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.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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<T : ApplicationCommandOptionAggregateBuilder<T>> : ApplicationCommandBuilder<T> {
/**
* @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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ interface MessageCommandInfo : TopLevelApplicationCommandInfo, ApplicationComman

override val discordOptions: List<MessageContextCommandOption>
get() = parameters.flatMap { it.allOptions }.filterIsInstance<MessageContextCommandOption>()

@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 }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.application.context.options.C
interface MessageContextCommandParameter : ContextCommandParameter {
override val nestedAggregatedParameters: List<MessageContextCommandParameter>

@Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
override val command: MessageCommandInfo get() = executable
override val executable: MessageCommandInfo
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ interface UserCommandInfo : TopLevelApplicationCommandInfo, ApplicationCommandIn

override val discordOptions: List<UserContextCommandOption>
get() = parameters.flatMap { it.allOptions }.filterIsInstance<UserContextCommandOption>()

@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 }
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,5 @@ import io.github.freya022.botcommands.api.commands.application.context.user.User
interface UserContextCommandParameter : ContextCommandParameter {
override val nestedAggregatedParameters: List<UserContextCommandParameter>

@Deprecated("Renamed to 'executable'", replaceWith = ReplaceWith("executable"))
override val command: UserCommandInfo get() = executable
override val executable: UserCommandInfo
}
Loading

0 comments on commit ffeff8c

Please sign in to comment.