Marc
Marc
KKord
Created by Marc on 4/21/2025 in #help
User audio processing only works after rejoin
I am trying to do some audio processing using
voiceConnection.streams.incomingUserStreams
voiceConnection.streams.incomingUserStreams
but I am facing the weird issue that when, for example I am in a voice channel and have the bot join me, the flow only starts emitting packets after I rejoin the channel. In general it seems to only work if the bot is in the channel before the target user joins. Is there a way to fix that?
23 replies
KKord
Created by Marc on 4/9/2023 in #help
Sending a message with an image attachment
I am trying to send a message with an image attachment as a command reply. This is the relevant code:
val image = interaction.command.attachments["image"]!!

val uploadedImageChannel = httpClient.get(image.url).bodyAsChannel()

val response = interaction.channel.createMessage {
files += NamedFile(image.filename, ChannelProvider(size = image.size.toLong()) { uploadedImageChannel })
}
val image = interaction.command.attachments["image"]!!

val uploadedImageChannel = httpClient.get(image.url).bodyAsChannel()

val response = interaction.channel.createMessage {
files += NamedFile(image.filename, ChannelProvider(size = image.size.toLong()) { uploadedImageChannel })
}
This used to work fine, but now I get this error:
2023-04-09T00:41:53.861+0000 [DefaultDispatcher-worker-3] ERROR dev.kord.core.Kord - catching(dev.kord.rest.request.KtorRequestException: REST request returned an error: 400 Bad Request Cannot send an empty message null)
dev.kord.rest.request.KtorRequestException: REST request returned an error: 400 Bad Request Cannot send an empty message 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:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
2023-04-09T00:41:53.861+0000 [DefaultDispatcher-worker-3] ERROR dev.kord.core.Kord - catching(dev.kord.rest.request.KtorRequestException: REST request returned an error: 400 Bad Request Cannot send an empty message null)
dev.kord.rest.request.KtorRequestException: REST request returned an error: 400 Bad Request Cannot send an empty message 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:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)
I tried looking into that spot and it seems like the Discord API just directly returns the error about the empty message with an error code of 50006. The image I am appending is definitely valid - if I output it to my PC instead of attaching it, it shows no signs of corruption.
11 replies