Shabbat 30b

The Divine Spirit does not rest upon a person who is sad, but only upon one filled with the joy of a mitzvah.