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:33

And when adversity touches the people, they call upon their Lord, turning in repentance to Him. Then when He lets them taste mercy from Him, at once a party of them associate others with their Lord,  

And when some distress, some hardship, befalls people, that is, ˹people such as˺ the Meccan disbelievers, they call on their Lord, turning, returning, in penitence to Him, alone. Then, when He lets them taste mercy from Him, by way of rain, lo! a party of them ascribe partners to their Lord.
القرآن:٣٠:٣٣

وَإِذَا مَسَّ النَّاسَ ضُرٌّ دَعَوْا رَبَّهُمْ مُنِيبِينَ إِلَيْهِ ثُمَّ إِذَا أَذَاقَهُمْ مِنْهُ رَحْمَةً إِذَا فَرِيقٌ مِنْهُمْ بِرَبِّهِمْ يُشْرِكُونَ  

{وإذا مسَّ الناس} أي كفار مكة {ضرٌّ} شدة {دعوا ربهم منيبين} راجعين {إليه} دون غيره {ثم إذا أذاقهم منه رحمة} بالمطر {إذا فريقٌ منهم بربهم يشركون}.