SC2 is sadly missing native discord integration, so I went ahead and did it myself.
You can find the source code and more information here: https://github.com/HorizonShadow/SCRichPresence
You can download it here: https://github.com/HorizonShadow/SCRichPresence/releases
This uses the StarCraft 2 Client Api, and is therefor perfectly legal: https://us.battle.net/forums/en/sc2/topic/20748195420
Disclaimer: I am not a c++ programmer. If you know c++ and see something egregious, please submit and issue or a pull request.