JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
122 stars 23 forks source link

Handle reply error #38

Open Fatonndev opened 2 years ago

Fatonndev commented 2 years ago

Error in console: [ERROR] Handle reply error Error("unknown variant unknown, expected one of offline, online, idle, dnd", line: 0, column: 0)

Code:

public static void init() {
    File discordLibrary = downloadDiscordLib();
    Core.init(discordLibrary);

    CreateParams params = new CreateParams();
    params.setClientID(Long.parseLong(Global.DISCORD_APP_ID));
    params.setFlags(CreateParams.getDefaultFlags());

    params.registerEventHandler(new DiscordEventAdapter() {
        @Override
        public void onActivityJoinRequest(DiscordUser user) {
            super.onActivityJoinRequest(user);
            System.out.println(user);
        }
    });

    Activity activity = new Activity();

    activity.setDetails("Running an example");
    activity.setState("and having fun");

    activity.timestamps().setStart(Instant.now());

    activity.party().size().setMaxSize(100);
    activity.party().size().setCurrentSize(10);

    activity.assets().setLargeImage("logo");

    activity.party().setID("Party!");
    activity.secrets().setJoinSecret("Join!");

    Core core = new Core(params);
    core.activityManager().updateActivity(activity);

    while (true) {
        core.runCallbacks();

        try {
            Thread.sleep(16);
        } catch(InterruptedException e) {
            e.printStackTrace();
        }
    }
}
JnCrMx commented 2 years ago

Please check that you are using the correct version of the Game SDK native library (that you apparently download in your downloadDiscordLib method).

You should be using version 2.5.6.

Fatonndev commented 2 years ago

I used discord library from https://dl-game-sdk.discordapp.net/2.5.6/discord_game_sdk.zip

Fatonndev commented 2 years ago

Along with this error, #39 also does not work. All events work except join request :(

JnCrMx commented 2 years ago

I was able to reproduce #39, but not this issue. On my machine the code you provided does not produce any error messages.

Could you please provide more information about your environment? Operating System, Java version, version of discord-game-sdk4j used.

Does the error appear every time you run the code or only sometimes?