diff --git a/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt b/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt index bda25be58..947a4cdef 100644 --- a/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt +++ b/backend/mirai-console/src/command/descriptor/CommandArgumentParserBuiltins.kt @@ -347,8 +347,15 @@ public object PermissionIdValueArgumentParser : InternalCommandValueArgumentPars public object PermitteeIdValueArgumentParser : InternalCommandValueArgumentParserExtensions() { override fun parse(raw: String, sender: CommandSender): PermitteeId { return if (raw == "~") sender.permitteeId - else kotlin.runCatching { AbstractPermitteeId.parseFromString(raw) }.getOrElse { - illegalArgument("无法解析 $raw 为被许可人 ID.") + else { + kotlin.runCatching { AbstractPermitteeId.parseFromString(raw) }.getOrElse { + val long = raw.toLongOrNull() + if (long != null) { + return AbstractPermitteeId.ExactUser(long)// for convenience + } + + illegalArgument("无法解析 $raw 为被许可人 ID.") + } } }