mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 18:40:15 +08:00
Support parsing self for PermissibleIdentifierArgumentParser
This commit is contained in:
parent
f24042f31e
commit
8a01dcc556
@ -320,7 +320,8 @@ public object PermissionIdArgumentParser : CommandArgumentParser<PermissionId> {
|
||||
@ExperimentalPermission
|
||||
public object PermissibleIdentifierArgumentParser : CommandArgumentParser<PermissibleIdentifier> {
|
||||
override fun parse(raw: String, sender: CommandSender): PermissibleIdentifier {
|
||||
return kotlin.runCatching { AbstractPermissibleIdentifier.parseFromString(raw) }.getOrElse {
|
||||
return if (raw == "~") sender.identifier
|
||||
else kotlin.runCatching { AbstractPermissibleIdentifier.parseFromString(raw) }.getOrElse {
|
||||
illegalArgument("无法解析 $raw 为 PermissibleIdentifier")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user