Check out example codes for "java discord bot get id of message it just sent". It will help you in understanding the concepts better.

Code Example 1

channel.sendMessage(content).queue((message) -> {
    long messageId = message.getIdLong();
    // use messageId here
});

Learn ReactJs, React Native from akashmittal.com