[AB-277] adding report mechanism via reactions

This commit is contained in:
Sheldan
2021-05-30 21:00:49 +02:00
parent d69f597663
commit 55e0879e06
30 changed files with 714 additions and 8 deletions

View File

@@ -331,6 +331,18 @@ public class ChannelServiceBean implements ChannelService {
return removeFieldFromMessage(channel, messageId, index, 0);
}
@Override
public CompletableFuture<Message> editFieldValueInMessage(MessageChannel channel, Long messageId, Integer index, String newValue) {
return retrieveMessageInChannel(channel, messageId).thenCompose(message -> {
EmbedBuilder embedBuilder = new EmbedBuilder(message.getEmbeds().get(index));
MessageEmbed.Field existingField = embedBuilder.getFields().get(index);
MessageEmbed.Field newField = new MessageEmbed.Field(existingField.getName(), newValue, existingField.isInline());
embedBuilder.getFields().set(index, newField);
log.debug("Updating field with index {} from message {}.", index, messageId);
return editEmbedMessageInAChannel(embedBuilder.build(), channel, messageId);
});
}
@Override
public CompletableFuture<Message> removeFieldFromMessage(MessageChannel channel, Long messageId, Integer index, Integer embedIndex) {
return retrieveMessageInChannel(channel, messageId).thenCompose(message -> {