minndevelopment / jda-ktx Goto Github PK
View Code? Open in Web Editor NEWCollection of useful Kotlin extensions for JDA
Home Page: https://minndevelopment.github.io/jda-ktx/
License: Apache License 2.0
Collection of useful Kotlin extensions for JDA
Home Page: https://minndevelopment.github.io/jda-ktx/
License: Apache License 2.0
Looks like the right time to bump the Kotlin version
https://kotlinlang.org/docs/whatsnew18.html#updated-jvm-compilation-target
I don't know if I'm using the correct implementation, but when I use this code the embeds always come out as being empty and gives the error message can't be built without content.
Dependencies are the exact same versions as the ones listed on the READ_ME
I am also getting this error within my editor when trying to use the code sample in the READ_ME:
Error Image
The code I tried
`
val message = Message {
embeds += Embed {
title = "Hespori Reaction Roles"
description = """
React below to select which Hespori Seeds you'd like to be notified about.
You'll be assigned a Discord Role for each reaction, and be tagged whenever your selected seeds are planted
:one: = Attas (Bonus XP)
:two: = Kronos (x2 Raids)
:three: = Iasor (x2 Drops)
:four: = Golpar (x2 Crystal Keys, Clues, etc.)
:five: = Noxifer (x2 Slayer points)
:six: = Buchu (x2 Boss Points)
:seven: = Celastrus (x2 Brimstone keys)
:eight: = Consecration (+5 PC Points)
:nine: = Kelda (x2 Larran's keys)
""".trimIndent()
}
}`
Add inline JDA builder, so creating the JDA instance can be more idiomatic.
Example usage:
val jda = DefaultJDA(botConfig.token) {
memberCachePolicy = MemberCachePolicy.ONLINE or MemberCachePolicy.VOICE or MemberCachePolicy.OWNER
chunkingFilter = ChunkingFilter.ALL
compression = Compression.ZLIB
largeThreshold = 250
rawEventsEnabled = false
enableShutdownHook = true
bulkDeleteSplittingEnabled = false
eventListeners += LoggingListener(this@PolyBot)
eventListeners += MessageCacheListener(this@PolyBot)
builder.injectKTX()
}
I have the code for this, will pr in a few.
Hello, I was forced to updated (tanks jitpack...), and I spent a lot of time finding out that dev.minn.jda.ktx.interactions.command
has been replaced by dev.minn.jda.ktx.interactions.slash
(to register slash commands).
It may be a good idea to document that change or better, make it deprecated before removing it...
Thanks!
Recently JDA added new intent MESSAGE_CONTENT, anyway I added it and the project started giving IllegalStateException error, it says that I have to add awaitStatus, I don't actually know exactly what should I use so I tried all of them and none of them work so idk if it's a bug or I have missed something! ( I'm using the last version )
My code :
val gateways = arrayListOf(
GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MEMBERS,
GatewayIntent.GUILD_MESSAGE_REACTIONS, GatewayIntent.GUILD_MESSAGES,
GatewayIntent.GUILD_MESSAGE_TYPING, GatewayIntent.GUILD_PRESENCES,
GatewayIntent.DIRECT_MESSAGES, GatewayIntent.DIRECT_MESSAGE_REACTIONS
)
val jda = light(token, enableCoroutines = true, intents = gateways) {
enableCache(
CacheFlag.ACTIVITY,
CacheFlag.ONLINE_STATUS,
CacheFlag.ROLE_TAGS,
CacheFlag.MEMBER_OVERRIDES,
)
disableCache(EnumSet.of(CacheFlag.EMOJI, CacheFlag.VOICE_STATE))
setMemberCachePolicy(MemberCachePolicy.ALL)
setChunkingFilter(ChunkingFilter.ALL)
addEventListeners(Events(Main), RPCEvent(), MessengerEvent())
}.awaitReady()
Exception in thread "main" java.lang.IllegalStateException: Was shutdown trying to await status
at net.dv8tion.jda.internal.JDAImpl.awaitStatus(JDAImpl.java:496)
at net.dv8tion.jda.api.JDA.awaitStatus(JDA.java:324)
at net.dv8tion.jda.api.JDA.awaitReady(JDA.java:374)
at Main$Companion.start(Main.kt:48)
at MainKt.main(Main.kt:77)
at MainKt.main(Main.kt)
jda-ktx/src/main/kotlin/dev/minn/jda/ktx/builder.kt
Lines 146 to 150 in d90709a
embed setter must be like
var embed: MessageEmbed? = null
set(value) {
builder.setEmbed(value)
field = value
}
and the nonce field is the save as above.
What's the status of this repository?
I know that, per your announcement, you're stepping away from JDA. And taking an extended break.
Does that include this repository as well?
Do you plan to continue supporting this repository and maintaining it with future JDA updates, as well as dealing with bug reports, and adding new features as needed?
If not, I'd be more than happy to take over maintaining this repository for you, given that I'm using it in my bot and I find it very useful.
Editing a message using a MessageEditData object causes a "Missing Permissions" error even though the bot has permission to send messages. However, giving the bot administrator permissions fixes the problem.
I have no clue what's going on here...
val messageId = channel.sendMessage("Test").await().idLong
delay(3.seconds)
// works
channel.editMessageById(messageId, "Edited").queue()
// doesn't work (but works with administrator permissions)
channel.editMessageById(messageId, MessageEdit {
content = "Edited"
}).queue()
Specs:
Kotlin: 1.5.0
JDK: 16
JVMTarget: 13
OS: Windows 10
JDA: 4.2.1_253
JDA-KTX: 0.3.1
Bug:
When using the EmbedBuilder from Builders.kt some fields are ignored.
What I found:
Steps to reproduce:
Just use the example Embed from the README.md
val embed = Embed {
title = "Hello Friend"
description = "Goodbye Friend"
field {
name = "How good is this example?"
value = "5 :star:"
inline = false
}
timestamp = Instant.now()
color = 0xFF0000
}
I'm trying to use jda#button() { //code } to make things way easier and don't need to use the event for the button but once the called this method I get an error I literally didn't understand it, maybe it's a bug for something?
Error ( ClassCastException ) :
class net.dv8tion.jda.api.hooks.InterfacedEventManager cannot be cast to class dev.minn.jda.ktx.events.CoroutineEventManager (net.dv8tion.jda.api.hooks.InterfacedEventManager and dev.minn.jda.ktx.events.CoroutineEventManager are in unnamed module of loader 'app')
Kotlin 1.6.20 is now out, and I'd love to use it for my bot.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.