Error registering slash commands

Hey, how can I fix this error? Command:
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kordex.core.i18n.types.Key

class WhitelistCommand(override val name: String = "whitelist") : Extension() {

override suspend fun setup() {
ephemeralSlashCommand {
name = Key("whitelist.command.name")
description = Key("whitelist.command.description")

action {
val modal = WhitelistModal()
val result = modal.sendAndDeferEphemeral(this)

if (result == null) {
respond {
content = "Es gab einem Fehler beim bearbeiten deiner Anfrage!"
}
} else {
respond {
content = "Deine Anfrage wurde erfolgreich bearbeitet!"
}
}
}
}
}
}
import dev.kordex.core.extensions.Extension
import dev.kordex.core.extensions.ephemeralSlashCommand
import dev.kordex.core.i18n.types.Key

class WhitelistCommand(override val name: String = "whitelist") : Extension() {

override suspend fun setup() {
ephemeralSlashCommand {
name = Key("whitelist.command.name")
description = Key("whitelist.command.description")

action {
val modal = WhitelistModal()
val result = modal.sendAndDeferEphemeral(this)

if (result == null) {
respond {
content = "Es gab einem Fehler beim bearbeiten deiner Anfrage!"
}
} else {
respond {
content = "Deine Anfrage wurde erfolgreich bearbeitet!"
}
}
}
}
}
}
strings.properties
whitelist.command.name=whitelist
whitelist.command.description=Füge dich zur Whitelist hinzu!
whitelist.modal.key=Key
whitelist.modal.key.placeholder=Dein Key
whitelist.modal.playername=Spielername
whitelist.modal.playername.placeholder=Dein Spielername
whitelist.modal.bedrock=Bedrock
whitelist.modal.bedrock.placeholder=Schreibe 'ja', wenn du Bedrock Spieler bist.
whitelist.command.name=whitelist
whitelist.command.description=Füge dich zur Whitelist hinzu!
whitelist.modal.key=Key
whitelist.modal.key.placeholder=Dein Key
whitelist.modal.playername=Spielername
whitelist.modal.playername.placeholder=Dein Spielername
whitelist.modal.bedrock=Bedrock
whitelist.modal.bedrock.placeholder=Schreibe 'ja', wenn du Bedrock Spieler bist.
No description
Solution:
Message Not Public
Sign In & Join Server To View
Jump to solution
34 Replies
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
No this is likely because your command names are invalid Unfortunately we don't have the full error to hand
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
Additionaly, your Key objects don't have a bundle
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
Yeah string didn't match the validation regex The regex is on Discord's side I think we could probably do better error handling here but I haven't had the chance
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
Yeah, missing a bundle from the Key here would cause a similar problem Since it's just sending the key verbatim The default bundle is the KordEx one for probably obvious reasons And yeah that key isn't in the KordEx bundle So @melone use "key".toKey(bundle) or use the Gradle plugin and generated Translations object
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
Mhm
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
I thought I documented this But clearly it's not obvious enough
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
Yep
Solution
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
melone
meloneOP3mo ago
Sorry, I will try it tomorrow. Thank you for your help guys. 🙂 thanks. 🙂
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
gdude
gdude3mo ago
All good
melone
meloneOP3mo ago
It's fixed now, I can run the command but if I implement the modal, I get this exceptions:
No description
No description
melone
meloneOP3mo ago
but if i test it with a simple message response, the command works
gdude
gdude3mo ago
that's because you're sending the modal manually don't do that
melone
meloneOP3mo ago
oh okay
gdude
gdude3mo ago
see how jansel did it here the unsafe module is available if you really do need to do it yourself, but if you just need the modal as the first response to your command, you don't need to do that
melone
meloneOP3mo ago
oh, i didn't see that screenshot. i'm sorry
gdude
gdude3mo ago
you're good
melone
meloneOP3mo ago
Is there something like a on/off toggle element in the modal?
gdude
gdude3mo ago
No they only support paragraph and line text inputs that's all discord gave us
melone
meloneOP3mo ago
:/ Modal works fine now, thank you. Hope, Discord will implement more input types soon. 😂
gdude
gdude3mo ago
they actually supported dropdowns at first release and discord removed them I'm not sure why
melone
meloneOP3mo ago
oh no discord is weird sometimes 😅
gdude
gdude3mo ago
there are lots of things that frustrate me about discord but that's a discussion for another time
melone
meloneOP3mo ago
Okay, I hope I don't bother you too much. I wish you all a good start to the new year!
gdude
gdude3mo ago
you're fine haha this is a support forum after all
melone
meloneOP3mo ago
🤝

Did you find this page helpful?