Hadithcore
Mishkat al-Masabih, 2224

He reported God’s messenger as. saying, “O God, I have entered into a covenant with You which You wilt not break. I am only a human being, so when I have injured, reviled, cursed or beaten a believer, make that for him a mercy, a purification and a means by which You wilt bring him near to You on the day of resurrection.” (Bukhari and Muslim.)

وَعَنْهُ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «اللَّهُمَّ إِنِّي اتَّخَذْتُ عِنْدَكَ عَهْدًا لَنْ تُخْلِفَنِيهِ فَإِنَّمَا أَنَا بَشَرٌ فَأَيُّ الْمُؤْمِنِينَ آذَيْتُهُ شَتَمْتُهُ لَعَنْتُهُ جَلَدْتُهُ فَاجْعَلْهَا لَهُ صَلَاةً وَزَكَاةً وَقُرْبَةً تُقَرِّبُهُ بِهَا إِلَيْكَ يَوْم الْقِيَامَة»

References1 variant
In-Book Reference
Book 9, Hadith 2