Fix mirroring sending to the same thread multiple times when misconfigured as channel id and thread

This commit is contained in:
Vankka 2023-12-26 18:48:11 +02:00
parent 6d4adebfd3
commit f0c5c7f1af
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0

View File

@ -172,14 +172,17 @@ public class DiscordMessageMirroringModule extends AbstractModule<DiscordSRV> {
}
CompletableFutureUtil.combine(futures).whenComplete((lists, t) -> {
Set<Long> channelIdsHandled = new HashSet<>();
for (MirrorOperation operation : lists) {
List<CompletableFuture<MirroredMessage>> mirrorFutures = new ArrayList<>();
for (MirrorTarget target : operation.targets) {
DiscordGuildMessageChannel mirrorChannel = target.targetChannel;
if (mirrorChannel.getId() == event.getChannel().getId()) {
long channelId = mirrorChannel.getId();
if (channelId == event.getChannel().getId() || channelIdsHandled.contains(channelId)) {
continue;
}
channelIdsHandled.add(channelId);
MirroringConfig config = target.config;
MirroringConfig.AttachmentConfig attachmentConfig = config.attachments;