Discord.com = Home

Redirects Discord homepage to a user-defined page or default URL

  1. // ==UserScript==
  2. // @name Discord.com = Home
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @license CC BY-NC
  6. // @description Redirects Discord homepage to a user-defined page or default URL
  7. // @author Unknown Hacker
  8. // @match https://discord.com/*
  9. // @run-at document-start
  10. // @grant GM_getValue
  11. // @grant GM_setValue
  12. // @grant GM_registerMenuCommand
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. const defaultRedirectUrl = "https://discord.com/channels/@me";
  19.  
  20. const redirectUrl = GM_getValue("redirectUrl", defaultRedirectUrl);
  21.  
  22. if (window.location.href === "https://discord.com/") {
  23. window.location.replace(redirectUrl);
  24. }
  25.  
  26. GM_registerMenuCommand("Set Redirect URL", () => {
  27. const newUrl = prompt("Enter the new redirect URL:", redirectUrl);
  28. if (newUrl) {
  29. GM_setValue("redirectUrl", newUrl);
  30. alert(`Redirect URL has been set to: ${newUrl}`);
  31. }
  32. });
  33.  
  34. GM_registerMenuCommand("Reset Redirect URL to Default", () => {
  35. GM_setValue("redirectUrl", defaultRedirectUrl);
  36. alert(`Redirect URL has been reset to the default: ${defaultRedirectUrl}`);
  37. });
  38. })();