diff --git a/shared.js b/shared.js
index ffb22c1..91b10e5 100644
--- a/shared.js
+++ b/shared.js
@@ -73,8 +73,43 @@
// post-init payload
document.addEventListener('ep-ready', () => {
+ // hijack the crash handler
+ // TODO: make this less ugly
+ $api.util.findFuncExports('CRASH', 'prototype').prototype.render = function () {
+
+ console.error('*** DISCORD CRASH!!! ***\nLOCKING DISPATCH AND HIJACKING PAGE');
+
+ // disable dispatch(), essentially freezing react
+ $api.internal.dispatcher.default.dispatch = () => { };
+
+ // clear css
+ $("link[rel='stylesheet']").remove();
+ $$("style").forEach(x => x.remove());
+
+ // add a simple style to the body
+ $('body').style.color = '#fff';
+ $('body').style.backgroundColor = '#000082';
+ $('body').style.fontFamily = 'monospace';
+
+ // write our message to app-mount
+ $('#app-mount').innerHTML = `
EndPwn: Discord Fatal Error
+
+Something has gone very, very wrong, and Discord has crashed.
+If this is the first time you've seen this error screen, press Ctrl+R and hope for the best. If this screen appears again, follow these steps:
+Try removing any new plugins and restarting again. If this solves the problem there may be a bug in the plugin.
+If problems continue, it's likely that there is a bug in EndPwn or Discord. Join the EndPwn Discord server for assistance.
+Details may be available in the console (Ctrl+Shift+I), but at this level of crash we can't be certain.
+
+
+`;
+
+ // crash whatever was calling render()
+ throw 'render abort';
+
+ }
+
// disable analytics
- $api.util.findFuncExports("AnalyticEventConfigs").default.track = () => {};
+ $api.util.findFuncExports("AnalyticEventConfigs").default.track = () => { };
// enable experiments
$api.util.findFuncExports('isDeveloper').__defineGetter__('isDeveloper', () => true);