diff --git a/backend/mirai-console/src/command/resolve/BuiltInCommandCallResolver.kt b/backend/mirai-console/src/command/resolve/BuiltInCommandCallResolver.kt index 95ab24b12..201985ffd 100644 --- a/backend/mirai-console/src/command/resolve/BuiltInCommandCallResolver.kt +++ b/backend/mirai-console/src/command/resolve/BuiltInCommandCallResolver.kt @@ -28,7 +28,7 @@ import net.mamoe.mirai.message.data.asMessageChain @ExperimentalCommandDescriptors public object BuiltInCommandCallResolver : CommandCallResolver { override fun resolve(call: CommandCall): CommandResolveResult { - val callee = CommandManager.matchCommand(call.calleeName) ?: return CommandResolveResult(null) + val callee = CommandManager.matchCommand(call.calleeName) ?: return CommandResolveResult(CommandExecuteResult.UnresolvedCommand(call)) val valueArguments = call.valueArguments val context = callee.safeCast()?.context diff --git a/backend/mirai-console/src/command/resolve/CommandCallResolver.kt b/backend/mirai-console/src/command/resolve/CommandCallResolver.kt index b715bcd4c..c8e69ba15 100644 --- a/backend/mirai-console/src/command/resolve/CommandCallResolver.kt +++ b/backend/mirai-console/src/command/resolve/CommandCallResolver.kt @@ -32,11 +32,11 @@ public class CommandResolveResult private constructor( public val failure: CommandExecuteResult.Failure? get() = value.safeCast() - public constructor(call: ResolvedCommandCall?) : this(call as Any?) + public constructor(call: ResolvedCommandCall) : this(call as Any?) public constructor(failure: CommandExecuteResult.Failure) : this(failure as Any) } -@OptIn(ExperimentalCommandDescriptors::class) +@ExperimentalCommandDescriptors public inline fun CommandResolveResult.fold( onSuccess: (ResolvedCommandCall?) -> R, onFailure: (CommandExecuteResult.Failure) -> R, @@ -50,9 +50,9 @@ public inline fun CommandResolveResult.fold( } -@OptIn(ExperimentalCommandDescriptors::class) +@ExperimentalCommandDescriptors public inline fun CommandResolveResult.getOrElse( - onFailure: (CommandExecuteResult.Failure) -> ResolvedCommandCall, + onFailure: (CommandExecuteResult.Failure) -> ResolvedCommandCall?, ): ResolvedCommandCall { contract { callsInPlace(onFailure, InvocationKind.AT_MOST_ONCE)