The solutions to you may vary in difficulty, but they are to both A) Stop being so hard on yourself, and by extension of A, B) Learn to let yourself be happy.
I know it sounds like a stuff cop-out, but it's true. If you keep convincing yourself that you're not worth anything or that life is pointless, then it will be. The only way out of that is to outright reject that notion, and then by extension reject the idea that life is there to mess you up.
Another thing is to stop focusing on the negatives. Every Thanksgiving, you'll hear the phrase "What are you thankful for?" thrown around like confetti, but I implore you to ask it to yourself more often. You have a roof over your head, two legs to walk on, two hands to feel the world, two eyes to witness beauty, a brain to think, and two ears to hear sounds and music. Surely this isn't for not.