Genesis 19:8 KJV
8 Behold now, I have two daughters which have not known man; let me, I pray you, bring them out unto you, and do ye to them as is good in your eyes: only unto these men do nothing; for therefore came they under the shadow of my roof.
So the just of this story is as follows.
God decides he wants to tourch Sodom and Gomorrah because he thinks they are all evil bastards. But he sends to male angels down to see if there is anything worth saving. I don’t really get that part, I mean an omnipotent god ought to know….
So the angels come upon Lot and go into his house. A crowd shows up and wants to rape them. Lot’s reaction isn’t to tell them they left. It isn’t to decide to fight. Nope. He tells them they can have his daughters if they leave. And this was the best God could find.
Later Lot’s daughters get him drunk and have sex with old Lot and end up knocked up. Lot was surely a righteous man.