Replace an image by editing a message Discord4j

415 Views Asked by At

I'm trying to have my bot go back to a previous message it sent and edit the message to have a new image which is an updated version of the old one.

The javadocs for MessageEditSpec.files() says that it Sets or replaces all elements for files list

The problem is, when I edit the message with a new image, the old one does not go away. I know this is not a limitation with the Discord API because my friend has this functionality working in a JavaScript discord bot.

Here is one of the attempts I've made at editing the image:

message.edit(MessageEditSpec.builder().files(List.of(File.of("test.png", inputStream))).build());

This results in what I described where I end up with two images in the original message.

Is there a way to achieve the desired functionality using discord4j?

0

There are 0 best solutions below