Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ internal class AppEmojisLoader internal constructor(
}

val oldCount = toLoad.size
clazz.objectInstance // Force initialization (and thus registration)
val _ = clazz.objectInstance // Force initialization (and thus registration)
if (oldCount == toLoad.size) {
logger.info { "No emojis were registered by ${clazz.simpleNestedName}" }
}
Expand Down
8 changes: 0 additions & 8 deletions BotCommands-autocomplete-caffeine/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-autocomplete-caffeine",
Expand Down
8 changes: 0 additions & 8 deletions BotCommands-commands/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-commands-app",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ internal class ApplicationCommandRateLimitHandler internal constructor(
internal suspend fun tryRun(commandInfo: ApplicationCommandInfoImpl, event: GenericCommandInteractionEvent, block: suspend (CancellableRateLimit) -> Boolean) {
val rateLimitInfo = commandInfo.rateLimitInfo
if (rateLimitInfo == null) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

if (enableOwnerBypass && event.user in botOwners) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

Expand Down
8 changes: 0 additions & 8 deletions BotCommands-commands/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-commands-core",
Expand Down
8 changes: 0 additions & 8 deletions BotCommands-commands/text/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-commands-text",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal class TextCommandVariationImpl internal constructor(

internal suspend fun tryParseOptionValues(event: BaseCommandEvent, matchResult: MatchResult?): Map<OptionImpl, Any?>? {
val groupsIterator = matchResult?.groups?.iterator()
groupsIterator?.next() //Skip the entire match
val _ = groupsIterator?.next() //Skip the entire match

return parameters.mapOptions { option ->
if (tryInsertOption(event, this, option, groupsIterator) == InsertOptionResult.ABORT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ internal class TextCommandRateLimitHandler internal constructor(
internal suspend fun tryRun(commandInfo: TextCommandInfoImpl, event: MessageReceivedEvent, block: suspend (CancellableRateLimit) -> Boolean) {
val rateLimitInfo = commandInfo.rateLimitInfo
if (rateLimitInfo == null) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

if (enableOwnerBypass && event.author in botOwners) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

Expand Down
8 changes: 0 additions & 8 deletions BotCommands-components/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal class ComponentController(
}
}

builder.filters.onEach { filter ->
builder.filters.forEach { filter ->
val filterClass = filter.javaClass
require(!filter.global) {
"Global filter ${filterClass.simpleNestedName} cannot be used explicitly, see ${Filter::global.reference}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ internal class ComponentsListener(
return event.reply(messagesFactory.get(event).componentNotAllowed(event)).setEphemeral(true).queue()
}

component.filters.onEach { filter ->
component.filters.forEach { filter ->
require(!filter.global) {
"Global filter ${filter.javaClass.simpleNestedName} cannot be used explicitly, see ${Filter::global.reference}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ internal class ComponentRateLimitHandler internal constructor(
internal suspend fun tryRun(component: ActionComponentData, event: GenericComponentInteractionCreateEvent, block: suspend (CancellableRateLimit) -> Boolean) {
val rateLimitReference = component.rateLimitReference
if (rateLimitReference == null) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

if (enableOwnerBypass && event.user in botOwners) {
block(NullCancellableRateLimit)
val _ = block(NullCancellableRateLimit)
return
}

Expand Down
4 changes: 0 additions & 4 deletions BotCommands-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ dokka {

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)

optIn.addAll(
"io.github.freya022.botcommands.api.core.annotations.ExperimentalCoreApi"
)
Expand Down
8 changes: 0 additions & 8 deletions BotCommands-modals/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ dependencies {

configureTests(libs.bytebuddy.agent)

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureJarArtifact(
artifactId = "BotCommands-modals",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class ClasspathWatcher private constructor() {
registerDirectories(classRoot)
}

thread(name = "Classpath watcher", isDaemon = true) {
val _ = thread(name = "Classpath watcher", isDaemon = true) {
while (true) {
val key = try {
watchService.take() // Wait for a change
Expand Down
3 changes: 0 additions & 3 deletions BotCommands-typesafe-messages/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ setMainJvmTarget(target = 24)
kotlin {
compilerOptions {
optIn.add("dev.freya02.botcommands.typesafe.messages.api.annotations.ExperimentalTypesafeMessagesApi")
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

Expand Down
8 changes: 0 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ tasks.withType<Test> {
useJUnitPlatform()
}

kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
)
}
}

publishedProjectEnvironment {
configureArtifact(
artifactId = "BotCommands",
Expand Down
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ kotlin {
freeCompilerArgs.addAll(
"-Xjsr305=strict",
"-Xconsistent-data-class-copy-visibility",
"-Xwarning-level=PLATFORM_CLASS_MAPPED_TO_KOTLIN:disabled"
"-Xwarning-level=PLATFORM_CLASS_MAPPED_TO_KOTLIN:disabled",
"-Xreturn-value-checker=check",
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jetbrains-annotations = "26.0.2"
jsr305 = "3.0.2"
junit = "6.0.1"
konsist = "0.17.3"
kotlin = "2.3.20"
kotlin = "2.4.0"
kotlin-logging = "7.0.3"
kotlinx-coroutines = "1.11.0"
kotlinx-serialization = "1.11.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class JavaInteropTest {

private val KType.jvmErasureOrNull: KClass<*>?
get() {
classifier ?: return null
if (classifier == null) return null
return jvmErasure
}

Expand Down
2 changes: 1 addition & 1 deletion test-bot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ tasks.withType<Test> {
kotlin {
compilerOptions {
freeCompilerArgs.addAll(
"-Xcontext-parameters",
"-Xcollection-literals",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ class MessageContextGetJson {

val messageObject = DataPath.getObject(dataObject, "d.data.resolved.messages").getObject(message.id)
val upload = FileUpload.fromData(messageObject.toPrettyString().encodeToByteArray(), "message-${message.id}.json")
event.reply_(files = listOf(upload), ephemeral = true).await()
event.reply_(files = [upload], ephemeral = true).await()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class SlashAggregate : GlobalApplicationCommandProvider, AutocompleteHandlerProv
this.showUserInput = false

caffeineCache {
compositeKeys = listOf("string", "nested_double")
compositeKeys = ["string", "nested_double"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SlashComponentsV2(
accessory = buttons.success("Button in a section").ephemeral {
bindTo { buttonEvent ->
buttonEvent.reply_(
components = listOf(TextDisplay("My reference ID is ${buttonEvent.component.uniqueId}")),
components = [TextDisplay("My reference ID is ${buttonEvent.component.uniqueId}")],
useComponentsV2 = true,
ephemeral = true,
).await()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SlashInteractionMetadata(
it.hook.sendMessage("Followup from button").queue()
}
}
event.reply_("Message from slash command", components = listOf(row(modalButton, messageButton)), ephemeral = true).queue()
event.reply_("Message from slash command", components = [row(modalButton, messageButton)], ephemeral = true).queue()

val buttonEvent = modalButton.await()
val modal = modals.create("Interaction metadata") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ class SlashModal(private val buttons: Buttons) : GlobalApplicationCommandProvide
definitelyNull: $definitelyNull
customObject: $customObject
""".trimIndent(),
components = listOf(row(buttons.primary("Test button").ephemeral {
components = [row(buttons.primary("Test button").ephemeral {
bindTo(::handleButton)
})),
})],
ephemeral = true
).queue()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ class SlashMyCommand : GlobalApplicationCommandProvider, SlashOptionChoiceProvid
option("stringOption", "string") {
description = "Option description"

choices = listOf(Choice("a", "a"), Choice("b", "b"), Choice("c", "c"))
choices = [Choice("a", "a"), Choice("b", "b"), Choice("c", "c")]
}

option("intOption", "int") {
description = "An integer"

valueRange = 1 range 2

choices = listOf(Choice("1", 1L), Choice("2", 2L))
choices = [Choice("1", 1L), Choice("2", 2L)]
}

option("doubleOption", "double") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private val logger = KotlinLogging.logger { }
@Command
@RequiresComponents
class SlashPagination(private val paginators: Paginators, private val buttons: Buttons) {
private val menuEntries = listOf("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve")
private val menuEntries = ["One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve"]

init {
Paginator.Defaults.firstPageButtonContent = ButtonContent.fromLabel(ButtonStyle.SECONDARY, "[Default] First")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SlashResolveMentions(private val buttons: Buttons) {
}
event.reply_(
"${forumChannel.asMention} ${threadChannel.asMention} ${archivedThreadChannel.asMention}",
components = listOf(row(button1, button2)),
components = [row(button1, button2)],
ephemeral = true
).await()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ abstract class AbstractMessagesTests : AbstractIntegrationTest() {

protected fun <F : KFunction<MessageCreateData>> methodCall(
callableRef: F,
executor: F.() -> Unit,
executor: F.() -> MessageCreateData,
): Pair<String, () -> Unit> {
return callableRef.name to { executor(callableRef) }
return callableRef.name to { val _ = executor(callableRef) }
}
}