Discord Emoji URL Extractor (Shift Modifier)

Quickly extract emoji URL from Discord when Shift+Clicking and copy it to clipboard with size=48, otherwise use default behavior. This is useful if you don't have nitro and still want to use animated emotes or any emote as a gif instead as a cheap mans emoji.

  1. // ==UserScript==
  2. // @name Discord Emoji URL Extractor (Shift Modifier)
  3. // @namespace https://greasyfork.org/en/scripts/531175-discord-emoji-url-extractor-shift-modifier
  4. // @version 1.2
  5. // @description Quickly extract emoji URL from Discord when Shift+Clicking and copy it to clipboard with size=48, otherwise use default behavior. This is useful if you don't have nitro and still want to use animated emotes or any emote as a gif instead as a cheap mans emoji.
  6. // @author Cragsand
  7. // @license MIT
  8. // @match *://discord.com/*
  9. // @grant GM_setClipboard
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. document.addEventListener('click', async function(event) {
  16. // Check if Shift is held down
  17. if (!event.shiftKey) {
  18. return; // Allow normal Discord behavior
  19. }
  20.  
  21. // Find the closest emoji button based on stable attributes
  22. let emojiButton = event.target.closest('button[data-type="emoji"]');
  23. if (emojiButton) {
  24. event.stopPropagation();
  25. event.preventDefault();
  26.  
  27. // Find the emoji image inside the button
  28. let emojiImg = emojiButton.querySelector('img[src*="cdn.discordapp.com/emojis/"]');
  29. if (emojiImg && emojiImg.src) {
  30. let emojiURL = new URL(emojiImg.src);
  31. emojiURL.searchParams.set('size', '48'); // Force size=48
  32.  
  33. // Copy modified emoji URL to clipboard
  34. try {
  35. await navigator.clipboard.writeText(emojiURL.toString());
  36. } catch (err) {
  37. console.error("Clipboard copy failed, using fallback:", err);
  38. GM_setClipboard(emojiURL.toString()); // Tampermonkey fallback
  39. }
  40. }
  41. }
  42. }, true);
  43. })();