You get the idea. If you accept that you’ll have days where you’re feeling low, then you’ll be much better able to handle them, dare I even say prepared. Maybe set aside a journal where you record all the positive things said about your writing. If you received feedback from a beta reader, a reader, a polite query response, a request for more material, these are all the type of things that might help “snap” you out of being discouraged. If may also include notes from other writers where they express appreciation for your support and how you touched them. By realizing that you do make a difference, it can be enough to lift you up.
Discouragement also can balance you with the realization that you are part of a writing community. You are not alone, you have support. You’re also not the first writer to ever feel the blues, and you won’t be the last. Knowing that others have been there, are there, and will feel the same as you helps you know that you’re on the right track. Discouragement is par for the course as they say for writers.