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.
quran:6:68

And when you see those who engage in ˹offensive˺ discourse concerning Our verses, then turn away from them until they enter into another conversation. And if Satan should cause you to forget, then do not remain after the reminder with the wrongdoing people.  

When you see those who engage in discourse about Our signs, the Qur’ān, in mockery, turn away from them, and do not sit with them, until they discourse on some other topic. And if (immā: the letter nūn of the conditional particle in has been assimilated with the extra mā) Satan should make you forget (read yunsiyannaka or yunassiyannaka), and you sit with them, then do not sit, after the reminder, that is, ˹after˺ you remember, with the evildoing folk (the overt noun ˹al-qawm al-zālimīn, ‘the evildoing folk’˺ replaces the ˹third person˺ pronominalisation).
القرآن:٦:٦٨

وَإِذَا رَأَيْتَ الَّذِينَ يَخُوضُونَ فِي آيَاتِنَا فَأَعْرِضْ عَنْهُمْ حَتَّىٰ يَخُوضُوا فِي حَدِيثٍ غَيْرِهِ ۚ وَإِمَّا يُنْسِيَنَّكَ الشَّيْطَانُ فَلَا تَقْعُدْ بَعْدَ الذِّكْرَىٰ مَعَ الْقَوْمِ الظَّالِمِينَ  

{وإذا رأيت الذين يخوضون في آياتنا} القرآن بالاستهزاء {فأعرض عنهم} ولا تجالسهم {حتى يخوضوا في حديث غيره وإما} فيه إدغام نون إن الشرطية في ما المزيدة {يُنسِيَنَّكَ} بسكون النون والتخفيف وفتحها والتشديد {الشيطان} فقعدت معهم {فلا تقعد بعد الذكرى} أي تذكرة {مع القوم الظالمين} فيه وضع الظاهر موضع المضمر وقال المسلمون إن قمنا كلما خاضوا لم نستطيع أن نجلس في المسجد وأن نطوف فنزل.