Hillary Clinton inspired grads at her alma mater ... to lean on the bottle when times get tough.

That's mostly a joke, but HRC did talk about how she's been coping during her commencement speech Friday at Wellesley College.

She was cracking wise about the election loss, but did fall back into campaign mode ... with a trademark coughing fit.

Not to worry ... she squeezed in a subtle jab at President Trump, saying ... "In the years to come there will be trolls galore. They may even call you a nasty woman."