mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Allow "1" for BooleanValueArgumentParser
This commit is contained in:
parent
2c5f9ebcf4
commit
0078ebd68f
@ -109,7 +109,7 @@ public object PlainTextValueArgumentParser : InternalCommandValueArgumentParserE
|
||||
}
|
||||
|
||||
/**
|
||||
* 当字符串内容为(不区分大小写) "true", "yes", "enabled"
|
||||
* 当字符串内容为(不区分大小写) "true", "yes", "enabled", "on", "1"
|
||||
*/
|
||||
public object BooleanValueArgumentParser : InternalCommandValueArgumentParserExtensions<Boolean>() {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user