i don’t want to reassure you, but since you feel so bad it proves you don’t want to do it again. you shouldn’t have been forced to do that, it’s not your fault
You did absolutely nothing wrong! Your friend is not a friend, quite the opposite. Rid him from your life if you have not done so already. You are so courageous for opening up here to complete strangers. You connected with people who struggle with you. Now, love yourself enough and have enough compassion for yourself to get rid of anyone who treats this way. I think you know what you do. You've already taken an incredible step forward. Next, please talk to a therapist, your loved ones, and true friends. Be vulnerable as hard as it may seem. Please read this book by Brene Brown "The Gifts of Imperfection".