sebm253 / BotListHandler

a library which handles discord bot lists stats updating for you
1 stars 0 forks source link

Javacord doesn't work #17

Open RealMarvn opened 1 year ago

RealMarvn commented 1 year ago

Hey, I was trying to implement this framework with Javacord but this error occurs all the time:

Caused by: java.lang.NoSuchMethodError: 'java.util.Collection org.javacord.api.DiscordApi.getServers()'
    at dev.mlnr.blh.javacord.BLHJavacordUpdater.getServerCount(BLHJavacordUpdater.java:67)
Caused by: java.lang.NoSuchMethodError: 'java.util.Collection org.javacord.api.DiscordApi.getServers()'

This is my code:

        Map<BotList, String> botLists = new EnumMap<>(BotList.class);
        botLists.put(BotList.TOP_GG, System.getenv("TopGGToken"));
        botLists.put(BotList.BOTS_ON_DISCORD, System.getenv("BotsForDiscordToken"));
        botLists.put(BotList.DBL, System.getenv("DiscordBotListToken"));

        BLHJavacordUpdater javaCordUpdater = new BLHJavacordUpdater(shardsById.values());

        new BLHBuilder(javaCordUpdater, botLists)
                .setAutoPostDelay(5, TimeUnit.MINUTES)
                .build();

ShardsById gives back a Map which contains every shard with its ID...So shardsById.values returns all Shards as a List

Is there any official fix? Best Regards Marvin

sebm253 commented 1 year ago

I'm not sure what the issue is - getServers() is present in newer versions of Javacord too so that cannot be the culprit I'd think. Can you reach back with your build file - Gradle/Maven?

also, keep in mind that I don't do Java anymore, therefore I don't have motivation to keep maintaining this project.

RealMarvn commented 1 year ago

plugins { id 'java' id 'application' id 'com.autonomousapps.dependency-analysis' version "1.0.0-rc02" id "org.jetbrains.kotlin.plugin.jpa" version "1.6.20" id "org.jetbrains.kotlin.jvm" version "1.6.20" id "org.jetbrains.kotlin.plugin.noarg" version "1.6.20" }

mainClassName = 'dev.marvn.interception.main.Interception'

version = "3.1.4"

noArg { annotation("jakarta.persistence.Entity") }

repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { url 'https://m2.dv8tion.net/releases' } maven { url 'https://jitpack.io' } }

dependencies {

//MYSQL
implementation 'org.hibernate:hibernate-core:6.1.2.Final'
implementation 'mysql:mysql-connector-java:8.0.30'
runtimeOnly 'org.hibernate:hibernate-hikaricp:6.1.2.Final'

//DISCORD-CDI
implementation 'org.javacord:javacord:3.5.0'
implementation group: 'dev.mlnr', name: 'BotListHandler-javacord', version: '2.0.0_5'
implementation 'net.kautler:command-framework:0.5.0'
implementation('jakarta.enterprise:jakarta.enterprise.cdi-api:3.0.1')
implementation('org.jboss.weld.se:weld-se-core:4.0.3.Final')
implementation('org.jboss:jandex:2.4.2.Final')

//LOGGER
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl', version: '2.17.2'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.17.2'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.2'

//MUSIC
implementation 'com.sedmelluq:lavaplayer-ext-youtube-rotator:0.2.3'
implementation 'com.github.natanbc:lavadsp:0.7.7'
implementation 'com.github.walkyst:lavaplayer-fork:1.3.97.1'
implementation 'com.github.Topis-Lavalink-Plugins:Topis-Source-Managers:2.0.6'

//BACKEND / REST
implementation 'io.javalin:javalin:4.6.4'
implementation 'com.github.twitch4j:twitch4j:1.11.0'

implementation 'io.github.openfeign:feign-core:11.9.1'
implementation 'io.github.openfeign:feign-gson:11.9.1'
implementation 'com.github.vladimir-bukhtoyarov:bucket4j:7.6.0'

implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.4'
implementation 'com.fasterxml.woodstox:woodstox-core:6.3.1'

}

sebm253 commented 1 year ago

try bumping BLH-javacord to 2.0.0_14.

RealMarvn commented 1 year ago

I did, the same error occurred

RealMarvn commented 1 year ago

I just took a look into your code and it doesnt seem to have any issus....I am going to take a look into my stuff.

RealMarvn commented 1 year ago

Ok so i looked into it and mby the endpoints changed on Top GG. The Stats arent updating and now there is no error.