Reputation: 41
How can I get a user mentioned in an embed? I tried something like this but it always returns null.
final String[] nome = {null};
channel.retrieveMessageById(reaction.getMessageId()).queue(message -> {
nome[0] = (message.getMentionedMembers().get(0).getEffectiveName());
});
Upvotes: 0
Views: 541
Reputation: 133
Your message is an embed so you can’t use it as a string. You need to get the embed from your message like this:
EmbedMessage eb = message.getEmbeds().get(0);
And then you can loop through fields and find the field you are looking for:
for (MessageEmbed.Field field : eb.getFields()) {
System.out.println(field.getValue());
}
Upvotes: 1