From 0078ebd68f705240093eb79e17f61bf92a171dee Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 28 Oct 2020 13:48:20 +0800 Subject: [PATCH] Allow "1" for BooleanValueArgumentParser --- .../command/descriptor/CommandArgumentParserBuiltins.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/descriptor/CommandArgumentParserBuiltins.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/descriptor/CommandArgumentParserBuiltins.kt index 4d0a78a62..4e0946376 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/descriptor/CommandArgumentParserBuiltins.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/command/descriptor/CommandArgumentParserBuiltins.kt @@ -109,7 +109,7 @@ public object PlainTextValueArgumentParser : InternalCommandValueArgumentParserE } /** - * 当字符串内容为(不区分大小写) "true", "yes", "enabled" + * 当字符串内容为(不区分大小写) "true", "yes", "enabled", "on", "1" */ public object BooleanValueArgumentParser : InternalCommandValueArgumentParserExtensions() { public override fun parse(raw: String, sender: CommandSender): Boolean = raw.trim().let { str -> @@ -117,6 +117,7 @@ public object BooleanValueArgumentParser : InternalCommandValueArgumentParserExt || str.equals("yes", ignoreCase = true) || str.equals("enabled", ignoreCase = true) || str.equals("on", ignoreCase = true) + || str.equals("1", ignoreCase = true) } }