Your battery by itself won’t be shocking you. The voltage is not high enough unless whatever body part it touched was wet, but even then...
If your laptop was not plugged-in to the outlet, it’s most likely electrostatic discharge from your body to the metal of your phone that’s connected to your MacBook. Maybe you have a carpet in your house and your body built up charge...
If your laptop was plugged-in, as some people have said, you may have a grounding issue with your outlet. If you have access to a volt meter (and know how to use it safely), measure between your outlet’s ground pin and power pins and ensure the voltages are per your country/local codes. If you can’t do it, have an electrician verify the grounding is good. Ideally, you will also have to check that the ground pin is truly tied to earth ground somewhere around your house.
This also assumes you are using a three-pin charger for your MacBook. If you aren’t, maybe look into getting one. In the US, the 120V has one of the pins as neutral which is grounded near the transformer. So we can get away with two pins for low power stuff. If you are using two pins, one of the pins (neutral) to the ground pin should be very close to 0V (won’t be exactly 0, but shouldn’t be more than 5VAC or so I imagine).