JnCrMx / discord-game-sdk4j

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

Ask to join doesn't work #39

Closed Fatonndev closed 2 years ago

Fatonndev commented 2 years ago

Invitations work, but the "Ask to join" button does not work

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); // Does work
        }
    });

    Activity activity = new Activity();

    activity.setDetails("Hello");
    activity.setState("world");

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

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

    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

Have you also tried the "Ask to join" option when you right-click the other user? The button on the Activity section of the Profile doesn't seem to work at all (tested with the native C version of the SDK). image

JnCrMx commented 2 years ago

Yes, I tried in on my machine and the context menu option (see the screenshot in the above comment) works fine.

As the button in the profile does not with the C API either, this seems to be an issue with the Discord client or the Game SDK itself. Sadly, I cannot fix it, please report it here: https://github.com/discord/discord-api-docs/issues

Feel free to reopen, if the context menu option doesn't work for you.