-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discord occasionally fails to send invite #35
Comments
Could you please share the piece of code you use to send the invites? I'm having trouble replicating the error. Also, how frequent does it occur? The only way I could get an error is by spamming invites, but it doesn't sound like that is what you are doing. |
Hi and thanks for the reply; sorry if I'm replying so late but I took a pause from the project I was working on I haven't checked my inbox in a while. By playing around with the code a couple of weeks ago I somehow alleviated the issue by putting everything on a separate thread instead of updating everything on the main thread like Discord suggested, now it happens less but it's still an issue. The way I handle Rich Presence and Invites is through a Record: public record RichPresence(
String largeImageID,
String largeImageText,
String smallImageID,
String smallImageText,
String details,
String state,
int currentPlayers,
int maxPlayers,
String partyID,
String joinSecret,
String spectateSecret,
String matchSecret,
boolean inInstance
)
//A RP status looks like this: RichPresence[largeImageID=the_crown, largeImageText=King's Client, smallImageID=crown_icon_black, smallImageText=, details=Playing on IglesiasCraft, state=IP: mc.iglesiascraft.it, currentPlayers=3, maxPlayers=420, partyID=5c6da8a2-d9a4-4e57-9be2-ac3ab0a55d80, joinSecret=mc.iglesiascraft.it, spectateSecret=spec:mc.iglesiascraft.it, matchSecret=, inInstance=true]
//This works, the status is displayed and the invite works too, sometimes it bugs out even if the invite and all is the exact same. I then have on a separate thread a "manager" that runs the callbacks every 16ms. I update Rich Presence with this method in the Manager: public void setRichPresence(@NotNull RichPresence richPresence) {
core.activityManager().updateActivity(richPresence.getActivity());
// System.out.println(richPresence); //debug message to see what's the RPstatus contents
} And this is the thread run method contents: @Override
public void run() {
init();
while (true) {
try {
if (running) { //this is a boolean that I use to make sure that everything is up and running, otherwise players can attempt to join before the game is even running
core.runCallbacks();
InvitesManager.tick(); //This just manages the ingame join and quit action + popup notificaiton, has nothing to do with the issue as i tried with and without it
}
} catch (Exception e) {
e.printStackTrace();
}
try {
sleep(16);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} Edit: The issue occurs occasionally when switching servers and it fixes itself occasionally, IDK why and how tho since I only update the RP once except when I join (my) server where I have a plugin telling the client what to put on RP (check the 1st post for an example of the server's custom RP status), and even there it reads everything fine, the RP status is displayed, the secrets are there and there's a pause between one status and another, it's not instantaneous (I even tried to clear the status before setting it) |
I don't know what's causing it, I have no clue if it's me or some weird syncing issue, but sometimes the SDK or the RPC server fails to process an invite.
When I try to invite someone in an activity I occasionally get a Unknown or Internal error from both the SDK and the RPC server + a Invalid Activity Action error with code 50039 on the Discord app's console.
Discord console error:
GameSDK Exception:
Discord Rich Presence Activity Payload:
(the party ID is not the issue, I tried with a UUID before that)
I'm trying to make a Minecraft Discord Integration if more context is needed.
Thanks in advance!
The text was updated successfully, but these errors were encountered: