It's important to always have control of your emotional state at all times. You should not let your outer world affect your inner world. There will be negative things that happen around you which will try bring down your emotional state but you must aim to not internalize the negativity.
People will treat you badly and say or do things that will make you angry and sad.
Don't personalize other people's behaviours. What someone does most of the time has absolutely nothing to do with you. People are very complex and have a lot of things going on that you might not actually understand or even know about. Don't internalize fleeting behaviours and emotions. Stop blaming yourself!
Always aim to not let external factors affect your emotional state.