From 189d8375cdc0151bdf9bbb9e8425dd7fbb990e1b Mon Sep 17 00:00:00 2001 From: Vankka Date: Sat, 10 Aug 2024 14:12:30 +0300 Subject: [PATCH] Tweak default uncached mention lookup and member caching --- .../discordsrv/common/config/main/MemberCachingConfig.java | 2 +- .../config/main/channels/MinecraftToDiscordChatConfig.java | 5 +++-- .../common/feature/mention/MentionCachingModule.java | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/discordsrv/common/config/main/MemberCachingConfig.java b/common/src/main/java/com/discordsrv/common/config/main/MemberCachingConfig.java index 270e6aa1..c3a845c3 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/MemberCachingConfig.java +++ b/common/src/main/java/com/discordsrv/common/config/main/MemberCachingConfig.java @@ -33,7 +33,7 @@ public class MemberCachingConfig { @Comment("If all members should be cached\n" + "Requires the \"Server Members Intent\"") - public boolean all = false; + public boolean all = true; @Comment("If members should be cached at startup\n" + "Requires the \"Server Members Intent\"") diff --git a/common/src/main/java/com/discordsrv/common/config/main/channels/MinecraftToDiscordChatConfig.java b/common/src/main/java/com/discordsrv/common/config/main/channels/MinecraftToDiscordChatConfig.java index aba90a17..679fb946 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/channels/MinecraftToDiscordChatConfig.java +++ b/common/src/main/java/com/discordsrv/common/config/main/channels/MinecraftToDiscordChatConfig.java @@ -83,8 +83,9 @@ public class MinecraftToDiscordChatConfig implements IMessageConfig { public boolean users = true; @Comment("If uncached users should be looked up from the Discord API when a mention (\"@something\") occurs in chat.\n" - + "The player needs the discordsrv.mention.lookup.user permission for uncached members to be looked up") - public boolean uncachedUsers = true; + + "The player needs the discordsrv.mention.lookup.user permission for uncached members to be looked up\n" + + "This WILL cause sending messages to be delayed") + public boolean uncachedUsers = false; @Comment("If @everyone and @here mentions should be enabled\n" + "The player needs the discordsrv.mention.everyone permission to render the mention and trigger a notification") diff --git a/common/src/main/java/com/discordsrv/common/feature/mention/MentionCachingModule.java b/common/src/main/java/com/discordsrv/common/feature/mention/MentionCachingModule.java index a6b272bc..c201c372 100644 --- a/common/src/main/java/com/discordsrv/common/feature/mention/MentionCachingModule.java +++ b/common/src/main/java/com/discordsrv/common/feature/mention/MentionCachingModule.java @@ -56,7 +56,7 @@ import java.util.stream.Collectors; public class MentionCachingModule extends AbstractModule { - private static final Pattern USER_MENTION_PATTERN = Pattern.compile("@[a-z0-9_.]{2,32}"); + private static final Pattern USER_MENTION_PATTERN = Pattern.compile("(?> memberMentions = new ConcurrentHashMap<>(); private final Map> memberMentionsCache = new ConcurrentHashMap<>();