The Prophet ﷺ said, "When one of you is invited, let him accept. If he is fasting, let him pray," meaning supplication.
حدثنا محمد بن جعفر قال حدثنا سعيد عن أيوب عن محمد بن سيرين
عن النبي ﷺ قال إذا دعي أحدكم فليجب فإن كان صائما فليصل يعني الدعاء
Its isnad is sahih, Muslim narrated it in the Book of Marriage, chapter on the command to accept an invitation from one who calls, 2/1054 no. 1431, and Abu Dawud narrated it at no. 2460 in the Book of Fasting, chapter on the fasting person being invited to a wedding feast. Tirmidhi narrated it, 3/141 no. 780, in the Book of Fasting, chapter on what has been said about the fasting person accepting an invitation, and he said, hasan sahih.