Abu Waqid reported,

While the Messenger of Allah ﷺ was sitting in the mosque with people gathered around him, three men approached. Two of them came toward the Messenger of Allah ﷺ while the third went away. When the two stopped before the Messenger of Allah ﷺ, they greeted him with peace. One of them noticed a gap in the circle and sat down in it. The other sat behind the gathering. The third turned away and left.When the Messenger of Allah ﷺ finished, he said, "Shall I tell you about these three men? As for one of them, he sought refuge with Allah, so Allah gave him refuge. As for the second, he felt shy, so Allah was shy toward him. As for the third, he turned away, so Allah turned away from him."

Tirmidhi 2724

Sahih

حدثنا الأنصاري حدثنا معن حدثنا مالك عن إسحق بن عبد الله بن أبي طلحة عن أبي مرة مولى عقيل بن أبي طالب

عن أبي واقد الليثي

أن رسول الله ﷺ بينما هو جالس في المسجد والناس معه إذ أقبل ثلاثة نفر فأقبل اثنان إلى رسول الله ﷺ وذهب واحد فلما وقفا على رسول الله ﷺ سلما فأما أحدهما فرأى فرجة في الحلقة فجلس فيها وأما الآخر فجلس خلفهم وأما الآخر فأدبر ذاهبا فلما فرغ رسول الله ﷺ قال ألا أخبركم عن النفر الثلاثة أما أحدهم فأوى إلى الله فأواه الله وأما الآخر فاستحيا فاستحيا الله منه وأما الآخر فأعرض فأعرض الله عنه

الترمذي 2724صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Permission and etiquette
Chapter
Three who came to the gathering of the Prophet ﷺ and that they would sit in the gathering wherever they found space
Numbering
Darussalam 2724
Tirmidhi 2724