Kord

K

Kord

Join the community to ask questions about Kord and get answers from other members.

Join

Get Heartbeat of Gateway

Mostly I need a way to check the connection status to the Discord API for a healthcheck. Is there any way in Kord to easily get this?

Is there a good way to register all commands at once?

I tried literally everything to get getKord().createGlobalApplicationCommands {} to function But unless i wanna create a massive file with every command in there seperately, it wont work....

Adding a file to a message using getResourceAsStream

val imageStream = javaClass.getResourceAsStream("/images/headerLink.png")
?: throw IllegalArgumentException("Image not found: /images/headerLink.png")
val imageStream = javaClass.getResourceAsStream("/images/headerLink.png")
?: throw IllegalArgumentException("Image not found: /images/headerLink.png")
...
Solution:
You can use ChannelProvider { imageStream.toByteReadChannel() }

Embed markdown for headers not working properly

I made an issue report and was told to come to this discord server to discuss this further ```kotlin channel.createEmbed { title = ""...
Solution:
headers do work in embeds
No description

Ephemeral message

Is there any way to create ephemeral message in Kord?
if (!isAdmin) {message.channel.createMessage(content = "You don't have enough permissions!")}
if (!isAdmin) {message.channel.createMessage(content = "You don't have enough permissions!")}
...

Custom status/activity

How to create custom status/activity - without "playing" and the like? ```kotlin client.editPresence { status = PresenceStatus.DoNotDisturb }...
No description

ClassNotFoundException: kotlinx.io.unsafe.UnsafeBufferOperations

I'm getting this error from using Kord in my Spigot plugin (Minecraft): ClassNotFoundException: kotlinx.io.unsafe.UnsafeBufferOperations. I have all the libraries loading, including kotlinx-io-core-jvm which the error is from. Any clues what could be the problem?

Dependency conflicts...

Kord is using ktor 3.0.0 I'm also using com.aallam.openai:openai-client which depends on ktor 2.3.2 How can I get around this?...

Opus stream to wav?

How can I take the incoming opus stream from a voice channel and save it as a wave file? I have the full opus audio sample as a ByteArray, how do I actually convert this to a wav file?...

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)...

How do I get the category a channel is in?

How do I get the category a channel is in, if any? I cant find it, I thought maybe its just based on whatever .getPosition() is but that seems like just a random number lol....

Possible to intercept a request to modify the payload?

If your application has several commands but needs some kind of notice attached to the response (like a embed with some info) you'd have to add it to every response manually. But is it possible to intercept the request payload for X type and modify it? In my case I have the command markdown </slash command:id> in several commands but I can't hardcode it as the ID changes whenever you update a command. So I just cache all the command IDs on load, but then I'd still have to format it in every single response. Instead I'd like to just intercept the request and format it in one function than every command I have or will add....

How do you create an embed?

I might be AM very stupid. But the only way i saw how to make an embed is to get a messagechannel and do .createMessage on there. But how do i send an embed as a reponse to an interaction? cause thats required a list of embeds (obv) but idk how to make a singular embed to put in that list....

How to add a file to a message as an attachment?

Pretty please. I've tried to use something similar to file.inputStream() but to no avail, and I can't find how to do this anywhere. I have a File (and its path as a String) and I wanna attach it in a createMessage. That's it. 🙂 Edit : forgot to mention but I use Kotlin, not Groovy...

Missing `DiscordChannel.message` for thread channels

Heya, whenever I create a thread in a thread-only channel (a forum), according to the docs I should receive the message that was originally used to create the thread. However this message is missing for me, it seems the thread always gets treated as a regular thread. In fact, I cannot even see the original message in the entire messages flow of the thread. I am thinking I am missing something obvious, any help would be appreciated 🙂...

Check if embed is removed by user

Hello How can I know if an embed has been removed by the user?...

How to generate push messages in channels?

Hey there, new to Kotlin/Kord in general. I'm trying to push messages to specific channels that my bot is in. The example in the github makes this esay becasue the channel is ready already. When I try to do something similar to the screenshot, the it.channelIds are always empty but I see the bot existing in the channel. What's the best way to approach something like this?...
No description

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. ...

Does receiveVoice still work?

I am working on an old voice bot I made a couple years ago and it seems like something in Kord is crashing as soon as there's any voice data from the server. I know it was considered experimental, but is it supposed to be able to work currently?

Can't get guild members

Hello, Inside a Guild Chat Input Command, I have this code: interaction.guild.members.toList() ...
Next