I was trying to find out who invited a user to my discord server, but JDA is not correctly displaying the list of who invited.
I was trying to find out who invited the user using:
List<Invite> invites = event.getGuild().retrieveInvites().complete();
for (Invite invite : invites) {
System.out.println(invite.getInviter);
}
and get the invitee's id in the same way:
for (Invite invite : invites) {
System.out.println("Inviter: " + invite.getInviter + "User: " + event.getUser.getId());
}
But this code shows all invites.
its not possible right now... You can't get a User from the InviteCode or reverse.
At least not in an easy way - you have to program it yourself via logging. You can find the complete explanation here:
Discord JDA - How to check how many users a user invited