kordlib / kordx.commands

Kotlin Command library for Kord and other APIs
MIT License
20 stars 3 forks source link

Breaks on latest Kord snapshots #34

Closed DRSchlaubi closed 3 years ago

DRSchlaubi commented 3 years ago

Trying to use the bot function breaks with latest kord version

Exception in thread "main" java.lang.NoSuchMethodError: 'int dev.kord.core.ClientResources.getShardCount()'
    at today.howoldisjava8.discord_bot.LauncherKt.main(Launcher.kt:91)

The problem is this line https://github.com/kordlib/kordx.commands/blob/49848297d2b87ad04081f905fc9fa9ca727f1bd6/kordx-commands-runtime-kord/src/main/kotlin/com/gitlab/kordlib/kordx/commands/kord/BotBuilder.kt#L115

Since the called functions is inline when compiling kxc it inlined this code

https://github.com/kordlib/kord/blob/aa46ddf6aa7257d710dc535b4f4c26c95a38763a/core/src/main/kotlin/Kord.kt#L114-L128

but the implementation has been updated to

https://github.com/kordlib/kord/blob/62ab68e41ef24e55d73802efa4f0ba7158c15ddd/core/src/main/kotlin/Kord.kt#L115-L129

this causes problems as ClientResources.shardCount no longer exists

DRSchlaubi commented 3 years ago

Should be fixed now. Will wait for @warriorzz to confirm

Edit: You might need to run this command to get the fix:

gradlew --refresh-dependencies
warriorzz commented 3 years ago

I used gradlew build --refresh-dependencies and it worked!