My gf tried to kill herself

Last night I was texting and venting to my girlfriend because she said I could. I guess after I went to sleep she took a whole bunch of pills without telling anyone. The next day I get a message from my girlfriend's guy friend, who she likes to talk to a lot about our relationship and I don't want to say they can't be friends but I personally don't like it. Anyway, he was just like "What the fuck, dude?" and I was confused and was like "what?" And then he followed up with "I guess you didn't mean to do it." So that obviously meant there was something, so I texted my girlfriend and she told me about it. I'm hurt she tried to do it without telling anyone, I'm hurt that my words and actions didn't matter then, I'm hurt she chose to tell him first instead of me. I don't know what to do and feel like it's my fault. She said she didn't want to die or anything and thought of me but it didn't stop her. I love her very much and I had a panic attack while talking to her about it. She said she's going to go to a mental hospital, which is good, but after that I mean like... I don't know if I want my girlfriend to talk to that friend anymore and I don't feel safe knowing that she's able to do it again and I don't want her to die because I'd die. I don't know what to do.