Solaris
Solaris
KKord
Created by Solaris on 9/9/2024 in #help
User installed command events not being received.
My application has User Install enabled in the developer portal and both integration_types and contexts are also added to the commands that should be used by users and the types of channels they can be used in. Kord doesn't official support User Apps but I modified the outgoing payload to add the two fields which does work, and some checks once an interaction is received to determine if it's an user app or server app integration type. The issue is I only receive events if the bot was installed to the guild. Previously (several hours ago), I did receive events for user installed apps in other guilds, DMs, and Group DMs. I've tried deleting the commands and adding them back, tried unauthorising the app and authorising them again, and removing the two fields above to add them back. Nothing seems to fix this issue. If code is useful:
val serializedCommands = Json.encodeToJsonElement(globalCommandBuilder.build())
val updatedCommands = ArrayList<JsonElement>()

for (serializedCommand in serializedCommands.jsonArray) {
val obj = serializedCommand.jsonObject.toMutableMap()
obj["integration_types"] = JsonArray(listOf(JsonPrimitive(0), JsonPrimitive(1)))
obj["contexts"] = JsonArray(listOf(JsonPrimitive(0), JsonPrimitive(1), JsonPrimitive(2)))
updatedCommands.add(JsonObject(obj))
}

kord.rest.unsafe(Route.GlobalApplicationCommandsCreate) {
keys[Route.ApplicationId] = kord.rest.application.getCurrentApplicationInfo().id
body(JsonElement.serializer(), JsonArray(updatedCommands))
}

// ...

kord.on<ChatInputCommandInteractionCreateEvent> {
println(interaction) // only receives guild install interactions, not user install interactions
}
val serializedCommands = Json.encodeToJsonElement(globalCommandBuilder.build())
val updatedCommands = ArrayList<JsonElement>()

for (serializedCommand in serializedCommands.jsonArray) {
val obj = serializedCommand.jsonObject.toMutableMap()
obj["integration_types"] = JsonArray(listOf(JsonPrimitive(0), JsonPrimitive(1)))
obj["contexts"] = JsonArray(listOf(JsonPrimitive(0), JsonPrimitive(1), JsonPrimitive(2)))
updatedCommands.add(JsonObject(obj))
}

kord.rest.unsafe(Route.GlobalApplicationCommandsCreate) {
keys[Route.ApplicationId] = kord.rest.application.getCurrentApplicationInfo().id
body(JsonElement.serializer(), JsonArray(updatedCommands))
}

// ...

kord.on<ChatInputCommandInteractionCreateEvent> {
println(interaction) // only receives guild install interactions, not user install interactions
}
Why might this be happening?
19 replies
KKord
Created by Solaris on 7/11/2024 in #help
kord cache method doesn't exist
error https://sourceb.in/rxnUgPpdxO gradle.build
include implementation("dev.kord:kord-core:0.14.0")
include implementation("dev.kord:kord-core-jvm:0.14.0")
include implementation("dev.kord:kord-rest:0.14.0")
include implementation("dev.kord:kord-rest-jvm:0.14.0")
include implementation("dev.kord:kord-common:0.14.0")
include implementation("dev.kord:kord-common-jvm:0.14.0")
include implementation("dev.kord:kord-gateway:0.14.0")
include implementation("dev.kord:kord-gateway-jvm:0.14.0")
include implementation('dev.kord.cache:cache-api:0.5.4')
include implementation('dev.kord.cache:cache-map-jvm:0.5.4')
include implementation("dev.kord:kord-core:0.14.0")
include implementation("dev.kord:kord-core-jvm:0.14.0")
include implementation("dev.kord:kord-rest:0.14.0")
include implementation("dev.kord:kord-rest-jvm:0.14.0")
include implementation("dev.kord:kord-common:0.14.0")
include implementation("dev.kord:kord-common-jvm:0.14.0")
include implementation("dev.kord:kord-gateway:0.14.0")
include implementation("dev.kord:kord-gateway-jvm:0.14.0")
include implementation('dev.kord.cache:cache-api:0.5.4')
include implementation('dev.kord.cache:cache-map-jvm:0.5.4')
can supply code but it's just a initializing Kord which causing this so probably just a dependency version issue but i'm not sure since since the cache libraries are latest as of today on mvnrepository
25 replies