Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
ahmad-zuhd:407ʿAbdullāh > Bī > Shujāʿ b. al-Walīd > Layth b. ʿArār > Muḥammad b. Juḥādah

[Machine] Allah revealed to Prophet David ﷺ that I have barred the oppressors from mentioning me and from sitting in my mosques. Verily, I have made a promise to myself that whoever remembers me, I will remember him. And indeed, when the oppressor mentions me, I curse him.  

الزهد لأحمد:٤٠٧حَدَّثَنَا عَبْدُ اللَّهِ حَدَّثَنِي أبِي أَخْبَرَنَا شُجَاعُ بْنُ الْوَلِيدِ عَنْ لَيْثِ بْنِ عَرَارٍ عَنْ مُحَمَّدِ بْنِ جُحَادَةَ قَالَ

أَوْحَى اللَّهُ ﷻ إِلَى دَاوُدَ عَلَيْهِ السَّلَامُ انْهَ الظَّالِمِينَ عَنْ ذِكْرِي وَعَنْ قُعُودٍ فِي مَسَاجِدِي؛ فَإِنِّي جَعَلْتُ عَلَى نَفْسِي أَوْ آلَيْتُ عَلَى نَفْسِي أَنَّ مَنْ ذَكَرَنِي ذَكَرْتُهُ وَإِنَّ الظَّالِمَ إِذَا ذَكَرَنِي لَعَنْتُهُ