Discord4j getting a username from id

232 Views Asked by At

is there any way in Discord4j to get someone's username using their id? The only way I have found so far is using UserData.builder().id("id").username("username").discriminator("0000").build();, but this requires you to manualy specify a username. Is there any other way?

1

There are 1 best solutions below

0
NovaFox161 On BEST ANSWER

You should not be building D4J DataX classes yourself. DataX classes are the raw JSON mappings of what Discord sends and are mapped using Jackson.

To get a user from ID: GatewayDiscordClient#getUserFromId(userId)