By incorporating the dihydropyridine amido (DHPA) group into the rationally designed ligand systems, metal–organic molecular polyhedra were obtained via self-assembly for the luminescent sensing of highly explosive RDX with a limit of detection lower than 1 ppb in solution.