Calculating nuclear dynamic effects in core-level spectroscopies with time-dependent density-functional theory