Skip to content

Commit

Permalink
Make it build
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed May 22, 2024
1 parent 99921a9 commit 57e6a69
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 31 deletions.
8 changes: 0 additions & 8 deletions kord-extensions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
maven {
Expand Down Expand Up @@ -55,12 +53,6 @@ dependencies {
kspTest(project(":annotation-processor"))
}

val compileKotlin: KotlinCompile by tasks

compileKotlin.kotlinOptions {
languageVersion = "1.7"
}

dokkaModule {
moduleName = "Kord Extensions"
includes.add("packages.md")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,16 +576,14 @@ public abstract class ApplicationCommandRegistry : KordExKoinComponent {
}
}

@Suppress("DEPRECATION_ERROR")
private fun <C : Choice> BaseChoiceBuilder<*, C>.translate(command: ApplicationCommand<*>) {
choices = choices!!.map {
val (name, nameLocalizations) = command.localize(it.name)

when (it) {
is Choice.NumberChoice -> Choice.NumberChoice(name, Optional(nameLocalizations), it.value)
is Choice.StringChoice -> Choice.StringChoice(name, Optional(nameLocalizations), it.value)
is Choice.IntegerChoice -> Choice.IntegerChoice(name, Optional(nameLocalizations), it.value)
else -> error("why isn't this exhaustive? :(")
when (val c = it as Choice) {
is Choice.NumberChoice -> Choice.NumberChoice(name, Optional(nameLocalizations), c.value)
is Choice.StringChoice -> Choice.StringChoice(name, Optional(nameLocalizations), c.value)
is Choice.IntegerChoice -> Choice.IntegerChoice(name, Optional(nameLocalizations), c.value)
} as C
}.toMutableList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ package com.kotlindiscord.kord.extensions.commands.application.slash

import com.kotlindiscord.kord.extensions.ArgumentParsingException
import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.commands.Argument
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.converters.*
import com.kotlindiscord.kord.extensions.commands.getDefaultTranslatedDisplayName
Expand Down Expand Up @@ -55,12 +54,11 @@ public open class SlashCommandParser {
}
} as Map<String, OptionValue<*>>

var currentArg: Argument<*>?
var currentValue: OptionValue<*>?

@Suppress("LoopWithTooManyJumpStatements") // Listen here u lil shit
while (true) {
currentArg = args.removeFirstOrNull()
val currentArg = args.removeFirstOrNull()
currentArg ?: break // If it's null, we're out of arguments

logger.trace { "Current argument: ${currentArg.displayName}" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ package com.kotlindiscord.kord.extensions.commands.chat
import com.kotlindiscord.kord.extensions.ArgumentParsingException
import com.kotlindiscord.kord.extensions.DiscordRelayedException
import com.kotlindiscord.kord.extensions.ExtensibleBot
import com.kotlindiscord.kord.extensions.commands.Argument
import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.CommandContext
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceConverter
Expand Down Expand Up @@ -100,11 +99,9 @@ public open class ChatCommandParser : KordExKoinComponent {

logger.trace { "Args map: $argsMap" }

var currentArg: Argument<*>?

@Suppress("LoopWithTooManyJumpStatements") // Listen here u lil shit
while (true) {
currentArg = args.removeFirstOrNull()
val currentArg = args.removeFirstOrNull()
currentArg ?: break // If it's null, we're out of arguments

val kwValue = keywordArgs[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import dev.kord.common.annotation.KordPreview
import dev.kord.core.event.Event

/** Type alias representing a string keyed map. **/
public typealias StringKeyedMap<T> = Map<String, T & Any>
public typealias StringKeyedMap<T> = Map<String, T>

/** Type alias representing a map with string keys and values. **/
public typealias StringMap = StringKeyedMap<String>

/** Type alias representing a mutable string keyed map. **/
public typealias MutableStringKeyedMap<T> = MutableMap<String, T & Any>
public typealias MutableStringKeyedMap<T> = MutableMap<String, T>

/** Type alias representing a mutable map with string keys and values. **/
public typealias MutableStringMap = MutableStringKeyedMap<String>
Expand Down
8 changes: 0 additions & 8 deletions test-bot/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
repositories {
maven {
Expand Down Expand Up @@ -74,12 +72,6 @@ dependencies {
kspTest(project(":annotation-processor"))
}

val compileKotlin: KotlinCompile by tasks

compileKotlin.kotlinOptions {
languageVersion = "1.7"
}

application {
this.mainClass.set("com.kotlindiscord.kord.extensions.testbot.TestBotKt")
}
Expand Down

0 comments on commit 57e6a69

Please sign in to comment.