Hadithcore
Mishkat al-Masabih, 3365

Abu Umama told that God’s Messenger gave ‘Ali a youth and said, “Do not beat him, for I have been prohibited from beating people who observe the prayer, and I have seen him praying.” This is the wording in <i>al-Masabih</i>.

أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم وَهَبَ لِعَلِيٍّ غُلَامًا فَقَالَ: «لَا تَضْرِبْهُ فَإِنِّي نُهِيتُ عَنْ ضَرْبِ أَهْلِ الصَّلَاةِ وَقَدْ رَأَيْتُهُ يُصَلِّي» . هَذَا لفظ المصابيح

References1 variant
In-Book Reference
Book 13, Hadith 278