diff --git a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt index 116d5c068..d6e3a85e0 100644 --- a/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt +++ b/backend/mirai-console/src/main/kotlin/net/mamoe/mirai/console/internal/command/CommandReflector.kt @@ -254,6 +254,10 @@ internal class CommandReflector( val instanceParameter = function.instanceParameter if (instanceParameter != null) { + check(instanceParameter.type.classifierAsKClass().isInstance(command)) { + "Bad command call resolved. " + + "Function expects instance parameter ${instanceParameter.type} whereas actual instance is ${command::class}." + } args[instanceParameter] = command }