The Messenger of Allah ﷺ said, "Whoever comes to this mosque of mine seeking only good, to learn it, holds the rank of a warrior striving in the path of Allah. But whoever comes for any other purpose is like a man gazing at another's possessions."
حدثنا قتيبة قال حدثنا حاتم بن إسماعيل عن حميد الخراط عن المقبري
قال رسول الله ﷺ من جاء مسجدي هذا لم يأت إلا لخير يتعلمه فهو بمنزلة المجاهد في سبيل الله ومن جاء لغير ذلك فهو بمنزلة رجل ينظر إلى متاع غيره