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:27:70

And grieve not over them or be in distress from what they conspire.  

And do not grieve for them, and do not be distressed by their schemes — this is meant to comfort the Prophet (s), in other words, do not be concerned with their plotting against you, for We will grant you victory over them.
القرآن:٢٧:٧٠

وَلَا تَحْزَنْ عَلَيْهِمْ وَلَا تَكُنْ فِي ضَيْقٍ مِمَّا يَمْكُرُونَ  

{ولا تحزن عليهم ولا تكن في ضيق مما يمكرون} تسلية للنبي * أي لا تهتم بمكرهم عليك فإنا ناصروك عليهم.

See similar narrations below:

Collected by Qurʾān
quran:16:127

And be patient, ˹O Muhammad˺, and your patience is not but through Allah. And do not grieve over them and do not be in distress over what they conspire.  

So be patient, and your patience is only by ˹the help of˺ God, ˹only˺ by His assistance. And do not grieve for them, that is, ˹for˺ the disbelievers if they do not believe, despite your eagerness that they believe, nor be in distress because of that which they scheme, in other words, do not be concerned with their scheming, for I ˹God˺ will make victorious over them.
القرآن:١٦:١٢٧

وَاصْبِرْ وَمَا صَبْرُكَ إِلَّا بِاللَّهِ ۚ وَلَا تَحْزَنْ عَلَيْهِمْ وَلَا تَكُ فِي ضَيْقٍ مِمَّا يَمْكُرُونَ  

{واصبر وما صبرك إلا بالله} بتوفيقه {ولا تحزن عليهم} أي الكفار. إن لم يؤمنوا لحرصك على إيمانهم {ولا تك في ضيق مما يمكرون} أي لا تهتم بمكرهم فأنا ناصرك عليهم.