nanobears
nanobears
KEKord Extensions
Created by nanobears on 10/27/2023 in #kordex-support
How would I utilize the new InteractionContext type?
I have this code currently:
return components {
if (references.any() && referencedNotes.isNotEmpty()) {
ephemeralStringSelectMenu {
placeholder = "Referenced notes"

references.take(25).forEach { result ->
val noteName = result.groupValues[1]

val referencedNote =
referencedNotes.filter { it.aliases.contains(noteName) }.random()

option(noteName, referencedNote._id.toString(16))
}

action {
edit {
viewNoteResponse(referencedNotes.first { it._id.toString(16) == selected.first() }, text)
}
}
}
}
}
return components {
if (references.any() && referencedNotes.isNotEmpty()) {
ephemeralStringSelectMenu {
placeholder = "Referenced notes"

references.take(25).forEach { result ->
val noteName = result.groupValues[1]

val referencedNote =
referencedNotes.filter { it.aliases.contains(noteName) }.random()

option(noteName, referencedNote._id.toString(16))
}

action {
edit {
viewNoteResponse(referencedNotes.first { it._id.toString(16) == selected.first() }, text)
}
}
}
}
}
viewNoteResponse is an extension in both PublicInteractionContext and EphemeralInteractionContext. I assume I would change the receiver to an InteractionContext and then remove the duplicate, but it gives me a type mismatch error when trying to use it where it was being used previously. what should I do to use this new type?
13 replies