Skip to content

Commit 281c0ea

Browse files
authored
Replace jda-ktx with our own module (#239)
1 parent ecc4c73 commit 281c0ea

File tree

179 files changed

+3986
-1110
lines changed

Some content is hidden

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

179 files changed

+3986
-1110
lines changed

BotCommands-core/build.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ dependencies {
2828
exclude(module = "opus-java")
2929
exclude(module = "tink")
3030
}
31-
api(libs.jda.ktx) {
32-
exclude(module = "JDA")
33-
}
31+
implementation(projects.botCommandsJdaKtx)
3432

3533
// Classpath scanning
3634
api(libs.classgraph)

BotCommands-core/src/examples/kotlin/io/github/freya022/bot/CoroutineEventManagerSupplier.kt

Lines changed: 0 additions & 14 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.github.freya022.bot.commands.slash
22

3+
import dev.freya02.botcommands.jda.ktx.messages.deleteDelayed
34
import io.github.freya022.bot.commands.ban.BanService
45
import io.github.freya022.bot.resolvers.localize
56
import io.github.freya022.bot.switches.KotlinDetailProfile
@@ -17,7 +18,6 @@ import io.github.freya022.botcommands.api.components.awaitAny
1718
import io.github.freya022.botcommands.api.components.event.ButtonEvent
1819
import io.github.freya022.botcommands.api.core.entities.InputUser
1920
import io.github.freya022.botcommands.api.core.service.annotations.BService
20-
import io.github.freya022.botcommands.api.core.utils.deleteDelayed
2121
import io.github.freya022.botcommands.api.localization.annotations.LocalizationBundle
2222
import io.github.freya022.botcommands.api.localization.context.AppLocalizationContext
2323
import io.github.freya022.botcommands.api.localization.context.editLocalized
@@ -167,4 +167,4 @@ class SlashBanSimplifiedFront(private val banImpl: SlashBan) : ApplicationComman
167167
@SlashOption(description = "The unit of the delete timeframe", usePredefinedChoices = true) unit: TimeUnit,
168168
@SlashOption(description = "The reason for the ban") reason: String = localizationContext.localize("outputs.defaultReason")
169169
) = banImpl.onSlashBan(event, localizationContext, target, DeleteTimeframe(time, unit), reason)
170-
}
170+
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.github.freya022.bot.commands.slash
22

3-
import dev.minn.jda.ktx.coroutines.await
4-
import dev.minn.jda.ktx.interactions.components.row
5-
import dev.minn.jda.ktx.messages.into
3+
import dev.freya02.botcommands.jda.ktx.components.into
4+
import dev.freya02.botcommands.jda.ktx.components.row
5+
import dev.freya02.botcommands.jda.ktx.coroutines.await
66
import io.github.freya022.botcommands.api.commands.annotations.Command
77
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
88
import io.github.freya022.botcommands.api.commands.application.CommandScope
@@ -48,4 +48,4 @@ class SlashButton(private val buttons: Buttons) : ApplicationCommand() {
4848
suspend fun onPersistentButtonClick(event: ButtonEvent) {
4949
event.editButton(event.button.asDisabled()).await()
5050
}
51-
}
51+
}

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

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

3-
import dev.minn.jda.ktx.messages.reply_
3+
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
@@ -47,4 +47,4 @@ class SlashChooseSimplifiedFront(private val slashChoose: SlashChoose) : Applica
4747
// Notice here how you are limited to 1 description for all your options
4848
@SlashOption(name = "choice", description = "A choice") @VarArgs(10, numRequired = 2) choices: List<String>
4949
) = slashChoose.onSlashChoose(event, choices)
50-
}
50+
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package io.github.freya022.bot.commands.slash
22

3-
import dev.minn.jda.ktx.interactions.components.SelectOption
4-
import dev.minn.jda.ktx.interactions.components.row
5-
import dev.minn.jda.ktx.messages.reply_
3+
import dev.freya02.botcommands.jda.ktx.components.SelectOption
4+
import dev.freya02.botcommands.jda.ktx.components.row
5+
import dev.freya02.botcommands.jda.ktx.messages.reply_
6+
import dev.freya02.botcommands.jda.ktx.requests.awaitCatching
67
import io.github.freya022.botcommands.api.commands.annotations.Command
78
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
89
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
@@ -15,7 +16,6 @@ import io.github.freya022.botcommands.api.components.builder.timeoutWith
1516
import io.github.freya022.botcommands.api.components.data.GroupTimeoutData
1617
import io.github.freya022.botcommands.api.components.event.ButtonEvent
1718
import io.github.freya022.botcommands.api.components.event.StringSelectEvent
18-
import io.github.freya022.botcommands.api.core.utils.awaitCatching
1919
import io.github.freya022.botcommands.api.localization.interaction.LocalizableInteractionHook
2020
import kotlin.time.Duration.Companion.seconds
2121

@@ -99,4 +99,4 @@ class SlashDelayedSelectMenu(
9999
.setReplace(true)
100100
.queue()
101101
}
102-
}
102+
}

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

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

3-
import dev.minn.jda.ktx.messages.reply_
3+
import dev.freya02.botcommands.jda.ktx.messages.reply_
44
import io.github.freya022.botcommands.api.commands.annotations.Command
55
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
66
import io.github.freya022.botcommands.api.commands.application.slash.GuildSlashEvent
@@ -34,4 +34,4 @@ class SlashModal(private val modals: Modals) : ApplicationCommand() {
3434
$code```
3535
""".trimIndent(), ephemeral = true).queue()
3636
}
37-
}
37+
}

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

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

3-
import dev.minn.jda.ktx.messages.reply_
3+
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
@@ -81,4 +81,4 @@ class SlashSentenceSimplifiedFront(private val slashSentence: SlashSentence) : A
8181
// Notice here how you are limited to 1 description for all your options
8282
@SlashOption(name = "part", description = "A sentence part", autocomplete = sentencePartAutocompleteName) @VarArgs(10, numRequired = 2) parts: SlashSentence.SentenceParts,
8383
) = slashSentence.onSlashSentence(event, parts)
84-
}
84+
}

BotCommands-core/src/kotlinDocExamples/kotlin/doc/kotlin/examples/commands/slash/SlashInMemoryRateLimit.kt

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

3-
import dev.minn.jda.ktx.messages.reply_
3+
import dev.freya02.botcommands.jda.ktx.messages.reply_
44
import io.github.freya022.botcommands.api.commands.annotations.Command
55
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
66
import io.github.freya022.botcommands.api.commands.application.provider.GlobalApplicationCommandManager
@@ -29,4 +29,4 @@ class SlashInMemoryRateLimit : ApplicationCommand(), GlobalApplicationCommandPro
2929
rateLimit(rateLimiter)
3030
}
3131
}
32-
}
32+
}

BotCommands-core/src/kotlinDocExamples/kotlin/doc/kotlin/examples/commands/slash/SlashPersistentRateLimit.kt

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

3-
import dev.minn.jda.ktx.messages.reply_
3+
import dev.freya02.botcommands.jda.ktx.messages.reply_
44
import io.github.bucket4j.distributed.proxy.ProxyManager
55
import io.github.freya022.botcommands.api.commands.annotations.Command
66
import io.github.freya022.botcommands.api.commands.application.ApplicationCommand
@@ -30,4 +30,4 @@ class SlashPersistentRateLimit(private val proxyManager: ProxyManager<String>) :
3030
rateLimit(rateLimiter)
3131
}
3232
}
33-
}
33+
}

0 commit comments

Comments
 (0)