Giter Site home page Giter Site logo

minndevelopment / jda-ktx Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 12.0 342 KB

Collection of useful Kotlin extensions for JDA

Home Page: https://minndevelopment.github.io/jda-ktx/

License: Apache License 2.0

Kotlin 100.00%
coroutines discord hacktoberfest jda kotlin kotlin-coroutines

jda-ktx's People

Contributors

cra1nbow avatar day-mon avatar leximon avatar minndevelopment avatar sanduhr32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jda-ktx's Issues

No documentation for the change of dev.minn.jda.ktx.interactions.command

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!

Inline Message Builder / Embed Builder

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()
    }

}`

Editing a message using the MessageEdit function causes a "Missing Permissions" error

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

Repository status?

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.

IllegalStateException project cannot starting

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 :

  • intents
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
            )
  • build :
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()
  • Error :
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)

Add Inline JDA Builder

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.

Builders not working right

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:

  • footer not working at all
  • timestamp never showing up
  • Message(content, embed) working but Message { content = content, embed { ... }} not working at all
  • description of Embed { } not working

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
        }

Renders to:
image

Should be:
image

throwing this error ClassCastException

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

The way how i use them:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.