Did you reach out to anyone when you were having those thoughts? There's always the Samaritans by phone, or SHOUT by text (text 85258 it's free and available 24/7)?
Have you managed to get up? Eat? Drink? Medicate?