Flying Porygon
Flying Porygon
Explore posts from servers
KKord
Created by Flying Porygon on 11/27/2024 in #help
Commands stop working after running for a longer amount of time
For some reason if the bot is running for a longer amount of time, the slash commands stop working and fail with the following error:
dev.kord.rest.request.KtorRequestException: REST request returned an error: 404 Unknown interaction null
at dev.kord.rest.request.KtorRequestHandler.handle(KtorRequestHandler.kt:61)
at dev.kord.rest.request.KtorRequestHandler$handle$1.invokeSuspend(KtorRequestHandler.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
dev.kord.rest.request.KtorRequestException: REST request returned an error: 404 Unknown interaction null
at dev.kord.rest.request.KtorRequestHandler.handle(KtorRequestHandler.kt:61)
at dev.kord.rest.request.KtorRequestHandler$handle$1.invokeSuspend(KtorRequestHandler.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
Restarting the bot fixes it and commands work again, but it seems to take a couple of days and then it just stops working. The non slash command portions of the bot continue to work fine, albeit slower (I assume that is the bot being rate limited) Is the bot running into some sort of quota or timeout issue?
4 replies
KKord
Created by Flying Porygon on 3/29/2024 in #help
Is there a way to use Kord with Springboot to login, run a quick command, and logout for an endpoint
I currently have Kord configured with Springboot, although there's one slight obvious hitch in my plan. When the endpoint is called and Kord logs in, it suspends itself (as expected) until I disconnect. This means that Spring Boot just hangs and it doesn't actually complete the rest of the request until I manually stop Spring Boot. Ideally what I would like to do is: - Get Kord client object/login (this is where it suspends) - Create Forum Thread - Post message to forum thread, pinging a specific user - Logout - Send HTTP response back This is the current basic login I have now:
private suspend fun loginToDiscord(): Kord? {
return try {
val client = Kord(botToken)
client.login {
@OptIn(PrivilegedIntent::class)
intents += Intent.MessageContent
}
Logger.info("Logged in to Discord")
client
} catch (e: Exception) {
Logger.error("{}", e)
null
}
}
private suspend fun loginToDiscord(): Kord? {
return try {
val client = Kord(botToken)
client.login {
@OptIn(PrivilegedIntent::class)
intents += Intent.MessageContent
}
Logger.info("Logged in to Discord")
client
} catch (e: Exception) {
Logger.error("{}", e)
null
}
}
3 replies