You take an opioid antagonist, like naltrexone, 1 hour prior to drinking. Since drinking produces endorphins, which are blocked by the antagonist, the brain stops associating drinking with pleasure, which results in a lower desire to drink.
The downside being that if you drink without the antagonist, your brain returns to its old patterns.
Anecdotally, my personal experience was after trying the method was that I no longer wanted to drink, and when I did, with or without the naltrexone, my problematic drinking behaviors mostly went away. I mostly abstain now.