Some advice needed

So I’ve been having a lot of drama w my boyfriends babymomma. She’s older than me and she’s really petty . Well she came to me once as a “friend” she wanted to be on good terms w me . I’m a good person quite naive tbh I fell for it . I’m pregnant and she knows so she told me how if I needed anything to let her know . We started talking more and well tbh my boyfriend before he wasn’t a good person he did me wrong but I gave him a chance to change and he has been changing but I still have some resentment and anger you know is not easy . Well we were just sharing stuff and she told me everything he would do before in the past while I was in a relationship w him I got really mad . And well I told her things about him that made him look bad I said how he doesn’t watch his daughters and how he doesn’t really take care of them . I pretty much talked bad about him I was mad and I regret it . Later on I found out she wasn’t honest w me and just faked to be friends w me she said she was gonna use my messages against him In court . Can she do that ? If they go to court can I say anything? Can I say I lied or it wasn’t me ? Im a little scared and i feel bad