refactor: make the bot disabled message only show when command is valid

This commit is contained in:
ChomeNS
2025-02-13 18:32:21 +07:00
parent ea671ec4d2
commit 6ba3a1cd2d
2 changed files with 4 additions and 5 deletions

View File

@@ -88,10 +88,7 @@ public class CommandHandlerPlugin {
final boolean discord = context instanceof DiscordCommandContext;
final boolean console = context instanceof ConsoleCommandContext;
if (!console) {
if (disabled) return Component.text("ChomeNS Bot is currently disabled").color(NamedTextColor.RED);
else if (commandPerSecond > 100) return null;
}
if (commandPerSecond > 100) return null;
commandPerSecond++;
@@ -108,6 +105,8 @@ public class CommandHandlerPlugin {
if (command == null && !inGame) return Component.text("Unknown command: " + commandName).color(NamedTextColor.RED);
else if (command == null) return null;
if (!console && disabled) return Component.text("ChomeNS Bot is currently disabled").color(NamedTextColor.RED);
final TrustLevel trustLevel = command.trustLevel;
if (trustLevel != TrustLevel.PUBLIC && splitInput.length < 2 && inGame) return Component.text("Please provide a hash").color(NamedTextColor.RED);