Yes, keeping healthy is important, as pointed out already. But the way you think can have a dramatic effect on how you feel. Having read a lot about thought challenging during difficult times, I now know you can change the way you feel by changing the way you think. It's easy to mistake miserable thoughts, ( I'm no good at anything, what's the point of trying?) as the product of low moods. However, if you take a mental step back and think, I'm good at cooking/ listening to my friends, I do have positive attributes, that makes you feel a bit better.
You can learn to stop yourself talking down - would you let someone you love/like fall into the habit of berating themselves? You'd probably say, hey, you're a good person, why would I love you if you were as awful as you think? Count your blessings, make a list of things you're good at, remember nice comments people have made. Be you own cheerleader. It may feel unnatural at first but you can learn to challenge your own thoughts, re-frame them, and move on to a better mood.