Kord Extensions

KE

Kord Extensions

The official server for Kord Extensions (KordEx), the premier Kotlin Discord bot framework.

Join

Can I load a .env file for a module instead of the whole project?

There are some utils for loading .env files, can this support the above? Or do I need to use my own solution here....
Solution:
I see what you mean, I'll change the working directory in the IDEA run configuration

Production instance's caching behaving very differently

So this one is a very odd one for me. I have different parts of my code where caching works fine on my test bot (5 servers) vs my production bot (16k servers). One example is this command where I'm using guild.getMemberOrNull to display a list of users (IDs coming from my DB) into strings with their usernames. The problem is that it takes a long time to resolve the response. I would understand if it took long to resolve once, and then subsequent calls didn't, because they are supposed to be cached (EntitySupplyStrategy.cacheWithCachingRestFallback), but every time, it takes a long time. We have tried to switching strategies for this particular command, like using cache only, and it would result in a lot of users just not being found. Now, recently, I added some channel permission checks to some task I have. And I noticed that since then, the task is taking a long time to complete. Upon checking my logs, I see a bunch of requests to https://discord.com/api/v10/guilds/<guildId>/members/<myBotId>, sometimes even making two calls within the same second (there is another permission check further down the task's execution)...
No description

How long do user commands take to register?

How long do user commands take to register?
Solution:
Well that's message commands

ephemeralStringSelectMenu option values

I'm trying to get the value of a selected option in the ephemeralStringSelectMenu from the components builder in the action. is this possible using conventional means? if not, what should be done instead? for reference, I'm trying to dynamically get something from my database with the value from the string select menu, which does not have static options and is also dynamically made...
Solution:
oh it's selected

how does defaultGuild interact with user apps?

I can't seem to test user commands with defaultGuild being set, is there a workaround for this?

How do monetization stuffs work?

I'm trying to monetize my bot/app how does this work with kordex?

Can you send an ephemeral response from a public slash command?

^
Solution:
```kotlin check { val user = userFor(event)!! val usage = usageService.checkUsage(user.id) event.extraData["usageResponse"] = usage...

My commands aren't updating

I've set the defaultGuild on my bot config, when I restart my bot, the commands aren't updated on my guild so I cannot test them.
Solution:
then don't use defaultGuild

ConcurrentModificationException errors

So today I finally released by bot to production, which was scary because it meant going from 3 servers to 16k servers... so of course I expected errors. This error is popping up on various places on my bot when accessing stuff from Discord. I'm using: defaultStrategy = EntitySupplyStrategy.cacheWithCachingRestFallback....
Solution:
@Galarzaa when https://github.com/kordlib/kord/pull/954 is merged, kord 0.15.0-SNAPSHOT should fix the issue
Message Not Public
Sign In & Join Server To View

Sentry DSN not detected

So I was redoing how I start the Sentry extension, to use enableIfDSN instead of doing the null check myself, and I noticed the Sentry extension was failing to initialize, and reverted it and it is still failing. So I don't know if this could have been caused by the latest changes? My bot is unable to start now if a Sentry DSN is set. I put a breakpoint in SentryAdapter.init and I can see that the DSN is available: Then on Sentry.java, line 187, there is a applyOptionsConfiguration function, it takes optionsConfiguration (which still has the settings there) and options, which is empty....
Solution:
I've pushed, should be up in 10-15 mins, hopefully it works
No description

Setting sentry's context

So I recently upgraded to the latest snapshot, and I'm trying to migrate this: ```kotlin sentry?.captureException(e) { setContexts(...
Solution:
See the announcement I just made - I've added two parameters to the capture functions, which should be sufficient

translations not translating

https://github.com/mazziechai/kose-kata/blob/main/src/main/kotlin/cafe/ferret/kosekata/extensions/UtilityExtension.kt see image for result when calling /clear why does this happen? i thought translate pulls from the bundle in the extension? it works elsewhere...
No description

Interactions no longer work after bot restart

Does Kordex support some way to make interactions still work after bot restart, besides using Kord's functions for creating components? More specifically, does Kordex support passing data through button IDs? (we'll likely contribute this functionality if it isn't alread supported)...
Solution:
You should handle the events

Getting all servers a bot is a part of

We've accidentally left the testing server of our bot, and we dunno its ID... Is there a way to get all servers a bot is in?
Solution:
presumably kord.guilds

What user/guild specific data is collected by the Sentry extension?

I'm currently in the process of writing up a privacy policy for a bot and just wanted to know what data is sent to Sentry that I'd need to include in it.
Solution:
Sentry submission data The following sections explain precisely what data Kord Extensions will send to Sentry, assuming you're using the provided default SentryAdapter and not your own custom subtype. Note: Sentry includes a number of options that aid with GDPR (and other privacy law) compliance. It's advisable to look through the settings that Sentry provides, and it's important to anonymise (or delete) Sentry events when the information is no longer needed....

How would I utilize the new InteractionContext type?

I have this code currently: ```kotlin return components { if (references.any() && referencedNotes.isNotEmpty()) { ephemeralStringSelectMenu {...
Solution:
it should probably be InteractionContext<*, *, *, *> right

Cannot import via gradle

Just setting up a new project. Depen: implementation("com.kotlindiscord.kord.extensions:kord-extensions:1.5.6") repo contains mavenCentral(), gradle is verion 8.2 Error: (Could Not Resolve: URI): https://paste.learnspigot.com/eyakecayet.csharp...
Solution:
Didnt know that would throw an error ```kt kotlin { jvmToolchain(8) // <- this should be 17...