The commas after commanded, asked, and whined, are generally dialog tags
. If you're providing dialog information in the middle of a sentence, you use the comma. If it's the end of a sentence, you can go for a period. E. g.
“That’s far enough!” she commanded. “Show yourself!” <-- I prefer this because the two bits of her speech are separate sentences. Same is true of the third sentence. The second one is just one sentence of speaking, interrupted by the dialog tag.