Skip to content

Commit f3b839d

Browse files
authored
Split up and deprecate ApplicationCommand / TextCommand (#252)
1 parent 443e3fb commit f3b839d

File tree

114 files changed

+324
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+324
-310
lines changed

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashBan.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import io.github.freya022.bot.switches.KotlinDetailProfile
88
import io.github.freya022.botcommands.api.commands.annotations.BotPermissions
99
import io.github.freya022.botcommands.api.commands.annotations.Command
1010
import io.github.freya022.botcommands.api.commands.annotations.UserPermissions
11-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
1211
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandManager
1312
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandProvider
1413
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
@@ -156,7 +155,7 @@ class SlashBanDetailedFront : GlobalApplicationCommandProvider {
156155

157156
@Command
158157
@KotlinDetailProfile(KotlinDetailProfile.Profile.KOTLIN)
159-
class SlashBanSimplifiedFront(private val banImpl: SlashBan) : ApplicationCommand() {
158+
class SlashBanSimplifiedFront(private val banImpl: SlashBan) {
160159
@UserPermissions(Permission.BAN_MEMBERS)
161160
@BotPermissions(Permission.BAN_MEMBERS)
162161
@JDASlashCommand(name = "ban", description = "Ban any user from this guild")

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashButton.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import dev.freya02.botcommands.jda.ktx.components.into
44
import dev.freya02.botcommands.jda.ktx.components.row
55
import dev.freya02.botcommands.jda.ktx.coroutines.await
66
import io.github.freya022.botcommands.api.commands.annotations.Command
7-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
87
import io.github.freya022.botcommands.api.commands.application.CommandScope
98
import io.github.freya022.botcommands.api.commands.application.slash.GlobalSlashEvent
109
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand
@@ -20,7 +19,7 @@ import kotlin.time.Duration.Companion.seconds
2019
import kotlin.time.toJavaDuration
2120

2221
@Command
23-
class SlashButton(private val buttons: Buttons) : ApplicationCommand() {
22+
class SlashButton(private val buttons: Buttons) {
2423
@TopLevelSlashCommandData(scope = CommandScope.GLOBAL)
2524
@JDASlashCommand(name = "button", description = "Try out the new buttons!")
2625
suspend fun onSlashButton(event: GlobalSlashEvent) {

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashChoose.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import dev.freya02.botcommands.jda.ktx.messages.reply_
44
import io.github.freya022.bot.switches.KotlinDetailProfile
55
import io.github.freya022.botcommands.api.commands.annotations.Command
66
import io.github.freya022.botcommands.api.commands.annotations.VarArgs
7-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
87
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandManager
98
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandProvider
109
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
@@ -40,7 +39,7 @@ class SlashChooseDetailedFront : GlobalApplicationCommandProvider {
4039

4140
@Command
4241
@KotlinDetailProfile(KotlinDetailProfile.Profile.KOTLIN)
43-
class SlashChooseSimplifiedFront(private val slashChoose: SlashChoose) : ApplicationCommand() {
42+
class SlashChooseSimplifiedFront(private val slashChoose: SlashChoose) {
4443
@JDASlashCommand(name = "choose", description = "Randomly choose a value")
4544
fun onSlashBan(
4645
event: GuildSlashEvent,

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashDelayedSelectMenu.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import dev.freya02.botcommands.jda.ktx.components.row
55
import dev.freya02.botcommands.jda.ktx.messages.reply_
66
import dev.freya02.botcommands.jda.ktx.requests.awaitCatching
77
import io.github.freya022.botcommands.api.commands.annotations.Command
8-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
98
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
109
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand
1110
import io.github.freya022.botcommands.api.components.Buttons
@@ -29,7 +28,7 @@ import kotlin.time.Duration.Companion.seconds
2928
class SlashDelayedSelectMenu(
3029
private val buttons: Buttons,
3130
private val selectMenus: SelectMenus
32-
) : ApplicationCommand() {
31+
) {
3332
private class Choices {
3433
var values: List<String> = emptyList()
3534
private set

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashFormat.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import dev.freya02.botcommands.jda.ktx.components.StringSelectMenu
44
import dev.freya02.botcommands.jda.ktx.components.TextInput
55
import dev.freya02.botcommands.jda.ktx.messages.reply_
66
import io.github.freya022.botcommands.api.commands.annotations.Command
7-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
87
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
98
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand
109
import io.github.freya022.botcommands.api.modals.Modals
@@ -17,7 +16,7 @@ private const val languageInputId = "SlashModal: languageInput"
1716

1817
@Command
1918
@RequiresModals
20-
class SlashFormat(private val modals: Modals) : ApplicationCommand() {
19+
class SlashFormat(private val modals: Modals) {
2120

2221
@JDASlashCommand(name = "format", description = "Formats your code")
2322
suspend fun onSlashFormat(event: GuildSlashEvent) {

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/slash/SlashSentence.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import dev.freya02.botcommands.jda.ktx.messages.reply_
44
import io.github.freya022.bot.switches.KotlinDetailProfile
55
import io.github.freya022.botcommands.api.commands.annotations.Command
66
import io.github.freya022.botcommands.api.commands.annotations.VarArgs
7-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
87
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandManager
98
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandProvider
109
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
@@ -74,7 +73,7 @@ class SlashSentenceDetailedFront : GlobalApplicationCommandProvider {
7473

7574
@Command
7675
@KotlinDetailProfile(KotlinDetailProfile.Profile.KOTLIN)
77-
class SlashSentenceSimplifiedFront(private val slashSentence: SlashSentence) : ApplicationCommand() {
76+
class SlashSentenceSimplifiedFront(private val slashSentence: SlashSentence) {
7877
@JDASlashCommand(name = "sentence", description = "Make a sentence")
7978
fun onSlashSentence(
8079
event: GuildSlashEvent,

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/text/TextExit.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package io.github.freya022.bot.commands.text
22

33
import io.github.freya022.botcommands.api.commands.annotations.Command
44
import io.github.freya022.botcommands.api.commands.text.BaseCommandEvent
5-
import io.github.freya022.botcommands.api.commands.text.TextCommand
65
import io.github.freya022.botcommands.api.commands.text.annotations.Hidden
76
import io.github.freya022.botcommands.api.commands.text.annotations.JDATextCommandVariation
87
import io.github.freya022.botcommands.api.commands.text.annotations.RequireOwner
@@ -13,7 +12,7 @@ import kotlin.system.exitProcess
1312
private val logger = KotlinLogging.logger { }
1413

1514
@Command
16-
class TextExit : TextCommand() {
15+
class TextExit {
1716
@Hidden
1817
@RequireOwner
1918
@JDATextCommandVariation(path = ["exit"])
@@ -24,4 +23,4 @@ class TextExit : TextCommand() {
2423
.mapToResult()
2524
.queue { exitProcess(0) }
2625
}
27-
}
26+
}

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/commands/text/TextNumber.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package io.github.freya022.bot.commands.text
22

33
import io.github.freya022.botcommands.api.commands.annotations.Command
44
import io.github.freya022.botcommands.api.commands.text.BaseCommandEvent
5-
import io.github.freya022.botcommands.api.commands.text.TextCommand
65
import io.github.freya022.botcommands.api.commands.text.annotations.JDATextCommandVariation
76
import io.github.freya022.botcommands.api.commands.text.annotations.TextOption
87
import kotlin.math.PI
98

109
@Command
11-
class TextNumber : TextCommand() {
10+
class TextNumber {
1211
@JDATextCommandVariation(path = ["number"])
1312
fun onTextNumber(event: BaseCommandEvent, @TextOption number: Int) {
1413
event.reply("$number * pi = ${number * PI}").queue()
1514
}
16-
}
15+
}

BotCommands-core/src/javaDocExamples/java/doc/java/examples/commands/slash/SlashRequestRole.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package doc.java.examples.commands.slash;
22

33
import io.github.freya022.botcommands.api.commands.annotations.Command;
4-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand;
54
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent;
65
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand;
76
import io.github.freya022.botcommands.api.modals.ModalEvent;
@@ -20,7 +19,7 @@
2019
import java.util.List;
2120

2221
@Command
23-
public class SlashRequestRole extends ApplicationCommand {
22+
public class SlashRequestRole {
2423

2524
private static final String MODAL_NAME = "request role";
2625
private static final String INPUT_ROLE = "role";

BotCommands-core/src/javaDocExamples/java/doc/java/examples/commands/slash/SlashSayAgainEphemeral.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package doc.java.examples.commands.slash;
22

33
import io.github.freya022.botcommands.api.commands.annotations.Command;
4-
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand;
54
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent;
65
import io.github.freya022.botcommands.api.commands.application.slash.annotations.JDASlashCommand;
76
import io.github.freya022.botcommands.api.commands.application.slash.annotations.Length;
@@ -17,7 +16,7 @@
1716

1817
@Command
1918
@RequiresComponents
20-
public class SlashSayAgainEphemeral extends ApplicationCommand {
19+
public class SlashSayAgainEphemeral {
2120
@JDASlashCommand(name = "say_again", subcommand = "ephemeral", description = "Sends a button to send a message again")
2221
public void onSlashSayAgain(
2322
GuildSlashEvent event,

0 commit comments

Comments
 (0)