Search code examples
javadiscord-jda

Can I change a user's nickname based on their ID?


Is it possible to change a user's nickname using their ID? I tried for a long time to solve this problem, but I never succeeded.


Solution

  • Why don't you use Member#modifyNickname?

    Member member = event.getMember();
    member.modifyNickname("Im a Maniac").queue();
    

    Since you haven't provided code I can't tell if this snippet would work, it should if you refactor it as to your needs.