Make sure to start Discord like this
C:\Users\user\AppData\Local\DiscordCanary\app-1.0.37>DiscordCanary.exe --remote-debugging-port=31337
Discord is a webapplication ported to desktop by using electron. Thus discord uses chrome and chrome comes with a built-in devtool tab. This script communicates with websockets to the remote-debugging-port to discord. Its able to execute Javascript leading to injections of all sorts and kinds