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:57:23

In order that you not despair over what has eluded you and not exult ˹in pride˺ over what He has given you. And Allah does not like everyone self-deluded and boastful -  

so that you may not (kay-lā: kay makes a verb subjunctive, with the same sense as an ˹as in an-lā, ‘so that … not’˺), that is to say, God informs ˹you˺ of this so that you may not, grieve for what escapes you, nor exult, with a wanton exultation, rather an exultation that is ˹followed by˺ a thanksgiving for the grace, at what He has given you (read ˹thus˺ as ātākum; or read as atākum, meaning, ‘˹at˺ what has come to you from Him’). For God does not like any swaggering braggart, ˹swaggering˺ in arrogance because of what he has been given, ˹boastful˺ of it to people;
القرآن:٥٧:٢٣

لِكَيْلَا تَأْسَوْا عَلَىٰ مَا فَاتَكُمْ وَلَا تَفْرَحُوا بِمَا آتَاكُمْ ۗ وَاللَّهُ لَا يُحِبُّ كُلَّ مُخْتَالٍ فَخُورٍ  

{لكيلا} كي ناصبة للفعل بمعنى أن، أي أخبر تعالى بذلك لئلا {تأسوا} تحزنوا {على ما فاتكم ولا تفرحوا} فرح بطر بل فرح شكر على النعمة {بما آتاكم} بالمد أعطاكم وبالقصر جاءكم منه {والله لا يحب كل مختال} متكبر بما أوتي {فخور} به على الناس.