How are they getting in? Check all the windows and doors to make sure the screens are properly fitted and that everything closes properly.
Here's an article about keeping away flies.
And here's one for moths.
I hope these help you. Wishing you the best.
Lots of tips here: https://www.craftylittlegnome.com/flies-house-suddenly/
We used a gallon sprayer (https://amzn.to/2Qcr66m) and sprayed on organic Pyrethrin (https://amzn.to/2Cz9QWe).