Discord: Enable Dark Mode

Enables dark mode on Discord.

  1. // ==UserScript==
  2. // @name Discord: Enable Dark Mode
  3. // @description Enables dark mode on Discord.
  4. // @version 1.0
  5. // @author Bard
  6. // @namespace https://bard.ai
  7. // @match *://*/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. "use strict";
  15.  
  16. // Get the Discord client.
  17. var Discord = require("discord.js");
  18.  
  19. // Create a new Discord client.
  20. var client = new Discord.Client();
  21.  
  22. // When the client is ready, enable dark mode.
  23. client.on("ready", async () => {
  24. // Get the current theme.
  25. var theme = await client.user.settings.get("theme");
  26.  
  27. // If the current theme is light, change it to dark.
  28. if (theme === "light") {
  29. await client.user.settings.set("theme", "dark");
  30. }
  31. });
  32.  
  33. })();