Sahih al-Bukhari, Book 67, Hadith 109 (Bukhari 4967)

Narrated Abu Musa:

The Prophet (ﷺ) said, "Set the captives free, accept the invitation (to a wedding banquet), and visit the patients."