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:30:36

And when We let the people taste mercy, they rejoice therein, but if evil afflicts them for what their hands have put forth, immediately they despair.  

And when We let people, that is, ˹people such as˺ the disbelievers of Mecca and others, taste some mercy, some grace, they exult in it, an exultation of arrogance. But if some evil, some hardship, befalls them for what their own hands have sent ahead, behold! they despair, of mercy. It is in the nature of a believer to give thanks in times of grace and to hope ˹for mercy˺ from his Lord in times of hardship.
القرآن:٣٠:٣٦

وَإِذَا أَذَقْنَا النَّاسَ رَحْمَةً فَرِحُوا بِهَا ۖ وَإِنْ تُصِبْهُمْ سَيِّئَةٌ بِمَا قَدَّمَتْ أَيْدِيهِمْ إِذَا هُمْ يَقْنَطُونَ  

{وإذا أذقنا الناس} كفار مكة وغيرهم {رحمة} نعمةً {فرحوا بها} فرح بطر {وإن تصبهم سيئة} شدة {بما قدمت أيديهم إذا هم يقنطون} ييأسون من الرحمة ومن شأن المؤمن أن يشكر عند النعمة ويرجو ربه عند الشدة.