Jda: EmbedMessage.addReaction not possible?

Created on 24 Oct 2018  路  6Comments  路  Source: DV8FromTheWorld/JDA

General Troubleshooting

  • [x] I have checked for similar issues.
  • [x] I have updated to the latest JDA version.
  • [x] I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

Issue

Issue Type

  • [ ] Bug Report
  • [x] Something in between (Not quite sure)
  • [ ] Feature Request

Description

Imma make it short;

I want add a Reaction to my EmbedMessage.
This kinda seems like not possible, while Message.addReaction for a Message Object exists, there's no similair method for EmbedMessage.

Please correct me if I'm wrong, and there actually is a way to do this, sorry then.

Most helpful comment

You don't create entities like that in JDA. You either get them from the library itself or use builders. Also, all of the Collections that JDA provides are immutable.
In your example, you could send the MessageEmbed directly and then use the callback in queue to access the actual Message object.
E.g.:

e.getTextChannel().sendMessage(EMBED.POLL(argsString, member)).queue((msg) -> {
   // here you can use the Message object
});

For questions like this you should join the official Discord server and ask there since the issues are the place for feature requests and bug reports.

All 6 comments

MessageEmbed objects aren't messages. You can only add reactions to actual messages.

The type is called MessageEmbed and its only a part of a Message just like Attachments. So in order to add reactions you need the actual Message that owns the embed.

Sorry for distubing again, but-

How would I exactly do this? I'm very sorry, as a beginner I'm pretty confused about that

I tried to

  1. Create a new Message Object, 2. Add my Embed, 3. Send it and 4. Add the reaction
Message message = new Message() {...};

message.getEmbeds().add(EMBED.POLL(argsString, member).build());

e.getTextChannel().sendMessage(message).queue();

message.addReaction(EmojiManager.getForAlias(":thumbsup|type_1_2:").getUnicode()).queue();

But that failed after message.getEmbeds() already, and I kinda get why

Probably because of this in my Message Object

@Override
public List<MessageEmbed> getEmbeds() {
    return null;
}

So I think that I'd probably have to change the return value, or even get a Message Object in another way

I tried around with this like for an hour now, but I don't seem to find a solution.. So, that's why I'm back here, asking you guys for a deeper explanation, big sorry once again for disturbing again!

You don't create entities like that in JDA. You either get them from the library itself or use builders. Also, all of the Collections that JDA provides are immutable.
In your example, you could send the MessageEmbed directly and then use the callback in queue to access the actual Message object.
E.g.:

e.getTextChannel().sendMessage(EMBED.POLL(argsString, member)).queue((msg) -> {
   // here you can use the Message object
});

For questions like this you should join the official Discord server and ask there since the issues are the place for feature requests and bug reports.

Also to note: You cannot add reactions to a message before it has been sent, so the way that @JohnnyJayJay has proposed for interacting is a valid way for doing that.

Works awesome, thanks a lot all of you!

Also, didn't know about the Discord, sorry! In future cases like this one, I'll definitely ask there instead of here!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StijnSimons picture StijnSimons  路  3Comments

liovy picture liovy  路  3Comments

Bungeefan picture Bungeefan  路  6Comments

MinnDevelopment picture MinnDevelopment  路  5Comments

YukioKeno picture YukioKeno  路  6Comments