How to get username by message id

46 Views Asked by At

I am facing a problem that I can't find out the username from the id of his message, I have tried many ways but I still can't do it, please help me.

I have no idea how to do this (second day learning JDA - Java Discord API)

1

There are 1 best solutions below

0
michel929 On BEST ANSWER

U need the TextChannel or PrivateChannel too...

channel.retrieveMessageById(id).queue((message) -> {
     User u = message.getAuthor();

     //only in TextChannels on Guilds
     Member m = message.getMember();
}

I hope I could help you :)