Before trying this, check out the official chat integration plugin for Discord
This PHP script acts an intermediary between Discourse and Discord, receiving webhooks from Discourse and parsing them into an optimal format before relaying them to Discord.
Just clone it!
git clone https://github.com/critcola/discourse-to-discord-webhook.git
This has been tested with and is supported on PHP 7.1, but should work fine on older versions of PHP.
config.php and populate all non-optional variables after configuring webhooks in both Discourse and Discord.
The Discourse to Discord Webhook script is released under the MIT License.