I was 30 when I went into a coma for three and a half weeks. I had spent the previous decade of my life as an alcoholic and drug addict, and had been managing my type 1 diabetes increasingly poorly. I was even selling my prescription blood sugar test strips on Craigslist, to make extra money to pay for marijuana and support my work as a standup comic. This meant I had no idea how much insulin to take at any given time.

I’d graduated years ago, but was continuing to drink as though I was still in college, and smoking weed every day. Things got so bad I sliced my face open by cycling into a car door when drunk. I was depressed and trying to self-medicate.

About two months after my birthday, in October 2014, I woke up and felt really sick, as if I had food poisoning. I started throwing up, so cancelled a few things I had planned for the weekend. But even though I was unwell, I decided to get high – and that’s the last thing I remember until nearly a month later.

My friends and family have helped me piece together what happened next. My roommate found me in a diabetic coma and called an ambulance. I was admitted to hospital in Chicago, where I live, and my parents immediately came up from Cincinnati, Ohio. My friends began keeping vigil; one set up a Facebook group with about 100 people in it, to keep them updated on my condition.

After three weeks without a breakthrough, it was looking likely that my life support was going to be turned off. Some of my closest friends came to say goodbye. One hadn’t realised how serious everything was until she got to the hospital. I had lost around 40 pounds and apparently when she first saw me she let out an anguished cry.

But at the last minute my parents decided to send me to a different hospital, one that was better equipped to deal with my level of trauma, in Cincinnati. My father, a doctor, arranged for me to be transferred via an air taxi service. A couple of days later he was standing next to my bed when I woke up. Apparently I mouthed, “What the fuck?”

The news began to spread that I was out of my coma. A few people thought it was a joke when they were first told; others didn’t realise I was alive until I updated my Facebook status.

It took a long time for me to recover. I was extremely weak: I had tremors in my hands and had to relearn how to walk. After a few weeks I logged on to my social media and took a proper look at it. I had about 150 Facebook wall posts from people I knew, mourning me, and my first thought was, “Holy shit!” It was strange looking at the messages and seeing how many people cared about me and saw good in me, at a time when it was hard for me to see that myself.

The eulogies were extremely kind, describing me as loyal, funny and someone whose friendship should be valued. Some people later said they felt embarrassed that I had seen their posts, and apologised for saying anything prematurely.

But their apologies were unnecessary, because I’m just grateful for this second chance at life. When I came out of hospital and returned to Chicago, I threw myself straight back into the comedy scene and wrote a show based on my coma, which I’m performing at the Edinburgh Fringe this month.

More importantly, I decided to go sober, and have been that way since. Being clean has helped me deal with who I am. I have learned to take rejection better, and I have been monitoring my diabetes properly. That’s not to say I’m a totally different person; I woke up with the same brain.

I don’t often return to those Facebook posts, but whenever I want, I can see people describing me as good, considerate, hardworking and kind; black-and-white evidence that runs counter to my own negative thoughts of myself. Those eulogies remind me why people care, and that I’m worthy of that care.

• As told to Kate Samuelson

Do you have an experience to share? Email experience@theguardian.com. Comments on this piece are premoderated to ensure the discussion remains on the topics raised by the article.