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 hbot = new BotInfo("#", null);
public BotInfo sbot = new BotInfo(":", null); public BotInfo sbot = new BotInfo(":", null);
public BotInfo chipmunk = 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 fnfboyfriend = new BotInfo("~", null);
public BotInfo qilk = new BotInfo(">", null); public BotInfo qilk = new BotInfo(">", null);
public BotInfo nbot = 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 @ConfigSerializable
public static class BotInfo { public static class BotInfo {
public String prefix; public String prefix;

View file

@ -71,7 +71,7 @@ public abstract class ChatScreenMixin {
ChipmunkMod.LOGGER.error("Error while trying to request TestBot webhook", e); 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<ChomeNSBotCommand> commands = ChomeNSBotCommandSuggestions.INSTANCE.commands;
final List<String> moreOrTrustedCommands = commands.stream() final List<String> moreOrTrustedCommands = commands.stream()