refactor: don't validate chomens automatically (you can still enable it in the config though)

This commit is contained in:
Chayapak Supasakul 2025-05-22 19:14:07 +07:00
parent cebe2629df
commit acfa11e74b
Signed by: ChomeNS
SSH key fingerprint: SHA256:0YoxhdyXsgbc0nfeB2N6FYE60mxMU7DS4uCUMaw2mvA
2 changed files with 18 additions and 5 deletions

View file

@ -34,7 +34,7 @@ public class Configuration {
public BotInfo hbot = new BotInfo("#", null);
public BotInfo sbot = new BotInfo(":", null);
public BotInfo chipmunk = new BotInfo("'", null);
public BotInfo chomens = new BotInfo("*", null);
public ChomeNSBotInfo chomens = new ChomeNSBotInfo("*", null, false);
public BotInfo fnfboyfriend = new BotInfo("~", null);
public BotInfo qilk = new BotInfo(">", null);
public BotInfo nbot = new BotInfo("?", null);
@ -56,6 +56,19 @@ public class Configuration {
}
}
@ConfigSerializable
public static class ChomeNSBotInfo extends BotInfo {
public boolean autoValidate;
public ChomeNSBotInfo () {
}
public ChomeNSBotInfo (final String prefix, @Nullable final String key, final boolean autoValidate) {
super(prefix, key);
this.autoValidate = autoValidate;
}
}
@ConfigSerializable
public static class BotInfo {
public String prefix;
@ -93,8 +106,8 @@ public class Configuration {
.hoverEvent(
HoverEvent.showText(
Component.text(
"Click here to open the ChipmunkMod source code (chayapak's fork)",
NamedTextColor.GREEN
"Click here to open the ChipmunkMod source code (chayapak's fork)",
NamedTextColor.GREEN
)
)
)
@ -105,7 +118,7 @@ public class Configuration {
HoverEvent.showText(
Component.text(
"Click here to copy the message to your clipboard",
NamedTextColor.GREEN
NamedTextColor.GREEN
)
)
)

View file

@ -71,7 +71,7 @@ public abstract class ChatScreenMixin {
ChipmunkMod.LOGGER.error("Error while trying to request TestBot webhook", e);
}
});
} else if (chatText.startsWith(ChipmunkMod.CONFIG.bots.chomens.prefix)) {
} else if (ChipmunkMod.CONFIG.bots.chomens.autoValidate && chatText.startsWith(ChipmunkMod.CONFIG.bots.chomens.prefix)) {
final List<ChomeNSBotCommand> commands = ChomeNSBotCommandSuggestions.INSTANCE.commands;
final List<String> moreOrTrustedCommands = commands.stream()