Just checkout here.
Learn a litle bit how pastebin api work: https://pastebin.com/doc_api
Learn discord webhook: https://discordjs.guide/popular-topics/webhooks.html#creating-webhooks-through-server-settings
Learn the webhook api: https://discord.com/developers/docs/resources/webhook
It will be pretty straightforward if you have some background.
I have made some working example you can test on here.
This one only use discord: https://gist.github.com/devmaars/26e544083ae2cab8859581e6bf4f6148
This use discord and pastebin: https://gist.github.com/devmaars/7ccaffa1f4bd3b8d137bd16ed2d9df25
For the second one you will have to set your own pastebin dev key.
Here is the dummy discord server you can live see the the crash log being pushed
https://discord.gg/yDw349UGtW
Note: this examples can be used for anything else not just crash log.