From 6030904d21e9e716f064ade82c921bfdd9b6d7e2 Mon Sep 17 00:00:00 2001 From: Sheldan <5037282+Sheldan@users.noreply.github.com> Date: Fri, 29 Dec 2023 15:32:39 +0100 Subject: [PATCH] [AB-xxx] fixing not considering allowed mentions for interactions --- .../core/interaction/InteractionServiceBean.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/abstracto-application/core/core-impl/src/main/java/dev/sheldan/abstracto/core/interaction/InteractionServiceBean.java b/abstracto-application/core/core-impl/src/main/java/dev/sheldan/abstracto/core/interaction/InteractionServiceBean.java index 524858b95..5e080cb30 100644 --- a/abstracto-application/core/core-impl/src/main/java/dev/sheldan/abstracto/core/interaction/InteractionServiceBean.java +++ b/abstracto-application/core/core-impl/src/main/java/dev/sheldan/abstracto/core/interaction/InteractionServiceBean.java @@ -58,9 +58,6 @@ public class InteractionServiceBean implements InteractionService { @Autowired private TemplateService templateService; - @Autowired - private FileService fileService; - public static final CounterMetric EPHEMERAL_MESSAGES_SEND = CounterMetric .builder() .name(DISCORD_API_INTERACTION_METRIC) @@ -296,6 +293,10 @@ public class InteractionServiceBean implements InteractionService { action = action.setEphemeral(messageToSend.getEphemeral()); } } + Set allowedMentions = allowedMentionService.getAllowedMentionsFor(callback.getMessageChannel(), messageToSend); + if(action != null) { + action.setAllowedMentions(allowedMentions); + } if(action == null) { throw new AbstractoRunTimeException("The callback did not result in any message."); @@ -312,7 +313,8 @@ public class InteractionServiceBean implements InteractionService { @Override public CompletableFuture replyString(String text, InteractionHook interactionHook) { - return interactionHook.sendMessage(text).submit(); + Set allowedMentions = allowedMentionService.getAllowedMentionsFor(interactionHook.getInteraction().getMessageChannel(), null); + return interactionHook.sendMessage(text).setAllowedMentions(allowedMentions).submit(); } @PostConstruct