Favor of the Lord for Good Man - Proverbs 12:2 “A good man obtained favour of the Lord; but a man of wicked devices will he condemn.
Matthew Henry commentary notes on this verse: OUr father judges of his children very much by their conduct one to another; and therefore a good man, that is merciful and charitable and does good draws out favour from the Lord by his prayers but a malicious man that devises wickedness against his neighbors he will condemn as unworthy of a place in His kingdom.

It is then right to see that God will always hear the prayers of the one that does His will. Everyone who obeys His will is righteous.