This is going to sound lame, but honestly taking care of your body by eating healthy, exercising, drinking plenty of water, getting adequate sleep, etc. can be helpful. Although, I know it's difficult to motivate yourself to do these things with anhedonia.
When I was trying to quit amphetamine I would drink coffee or make tea whenever I had the urge to redose- the effects of caffeine were painfully underwhelming in comparison, but it gave me something to do. This and reminding myself/focusing on the "end goal," or the purpose for quitting in the first place. Like you, I had to quit for mental health treatment.
I don't know if this was remotely helpful in any way, but regardless I hope you are able to find some kind of relief. My experience was hell. Even today it's hard. When I was eating pills like they were candy, I didn't feel like killing myself at least- but it does get a little easier to cope with over time.