Can’t sleep/cramps all night. 4wks preg.

I just found out I was pregnant yesterday on my 1 day late, and last night I could not sleep for the LIFE of me but not because of nerves or anything. I’m having cramps that are so uncomfortable and even diarrhea every 2/3 hours. When does this normally end? Can I take pills for this???