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:4:79

What comes to you of good is from Allah, but what comes to you of evil, ˹O man˺, is from yourself. And We have sent you, ˹O Muhammad˺, to the people as a messenger, and sufficient is Allah as Witness.  

Whatever good (hasana means khayr) befalls you, O man, it is from God, it has come to you from His bounty; whatever evil, misfortune, befalls you is from yourself, it has come to you as a necessary consequence of sins you have committed. We have sent you, O Muhammad (s), to people as a messenger (rasūlan, is a circumstantial qualifier for emphasis), and God suffices as Witness, of your Mission.
القرآن:٤:٧٩

مَا أَصَابَكَ مِنْ حَسَنَةٍ فَمِنَ اللَّهِ ۖ وَمَا أَصَابَكَ مِنْ سَيِّئَةٍ فَمِنْ نَفْسِكَ ۚ وَأَرْسَلْنَاكَ لِلنَّاسِ رَسُولًا ۚ وَكَفَىٰ بِاللَّهِ شَهِيدًا  

(ما أصابك) أيها الإنسان (من حسنة) خير (فمن الله) أتتك فضلا منه (وما أصابك من سيئة) بليَّة (فمن نفسك) أتتك حيث ارتكبت ما يستوجبها من الذنوب (وأرسلناك) يا محمد (للناس رسولا) حال مؤكدة (وكفى بالله شهيدا) على رسالتك.