Skip to content

Instantly share code, notes, and snippets.

@junebug12851
Last active May 10, 2024 11:23
Show Gist options
  • Save junebug12851/8c5c42587a824c22a79359fb56b4023d to your computer and use it in GitHub Desktop.
Save junebug12851/8c5c42587a824c22a79359fb56b4023d to your computer and use it in GitHub Desktop.
Extract all Discord emojis and stickers from all servers

Important Note!

Doing this requires running a script inside Discord, historically Discord has allowed these perfectly fine but it was for advanced people only and Discod discovered non-advanced users were copying and pasting random scripts people gave them which ended up being malicious and harmful to their account.

Discord has since blocked access to scripts unless you enable a hidden setting. The script below is open source and commented. Anyone is welcome to verify the legitimacy of it. It's very simple in how it works. However if you proceed further and enable custom scripts, I highly reccomend to disable it afterwards unless you know what you are doing. There's a reason Discord disabled this feature, don't even run scripts without knowing what they do first.

By proceeding you understand this warning and risks

Copyright Noice

This is intended for personal use only, as in, to download to your computer and not redistribute or give or use anywhere or to anyone. Obiosuly stickers and emojis are privtae to servers.

Actually this method was invented to get my enojis and stickers off of my own servers because of a hardware failure and I lost the original files. This method though will pull from every server your in so just respect peoples privacy and copyrights and dont let them leave your computer unless you own rights to them.

What this will do

Download all non-animated stickers and all emojis animated or not in their original form to your computer. webp files will be converted to png for easy universal access.

Step 1: Add this to the Discord settings file (And restart Discord by completely quitting and re-opening)

%appdata%/discord/settings.json

"DANGEROUS_ENABLE_DEVTOOLS_ONLY_ENABLE_IF_YOU_KNOW_WHAT_YOURE_DOING": true

Step 2: Do this inside of Discord

Ctrl + Shift + I

Step 3: Enter this in the console and press enter

// Holds All URLs
var urls = "";

// Internal function to add a url to the list of urls
function addAssetUrl(url)
{
    // If It's a .webp file, trim off the end and make it a png
    if(url.split(".webp").length > 1) {
        url = url.split(".webp")[0];
        url += ".png";
    }
    
    // If it's a .gif, .apng, or .png file, trim off the end and keep the extension as it is
    else if(url.split(".gif").length > 1) {
        url = url.split(".gif")[0];
        url += ".gif";
    }
    else if(url.split(".apng").length > 1) {
        url = url.split(".apng")[0];
        url += ".apng";
    }
    else if(url.split(".png").length > 1) {
        url = url.split(".png")[0];
        url += ".png";
    }

    // Add url to list of urls
    urls += url + "\n";
}

// Function you execute to capture currently loaded emojis
function getEmojis()
{
    // Grab all * potential * emoji links, some may be false
    var p = document.querySelectorAll("[class*=emojiItem]");

    // Loop through them
    for (var i = 0; i < p.length; i++) {
    
        // Get the image link contained inside the emoji
        // and make sure there actually is an image link
        // Remember, some that are captured arent actually emojis so we skip over them
        var url = p[i].children[0].src;
        if(!url)
            continue;

        // We've conformed it's an enoji link, add it to the list of urls
        addAssetUrl(url);
    }

    // This is just for fun, itsn ot nesesary, it tell you how many emoji links it captured
    // this time around
    return p.length;
}

// Same things but for stickers
function getStickers()
{
    // Same thing but gets sticker links
    var p = document.querySelectorAll("[class*=stickerAsset]");

    // Loop through all stickers
    for (var i = 0; i < p.length; i++) {
        // Get sticker URL and make sure it's a valid sticker
        var url = p[i].src
        if(!url)
            continue;

        // We've verified it's an actual sticker URL, add to list of links
        addAssetUrl(url);
    }

    // Again, for fun, not needed, just tells you how many stickers it captured
    return p.length;
}

// List all links, many will be duplicate which is fine
function listLinks()
{
    console.log(urls);
}

Step 4: Open the emojis panel in any server or dm, it doesnt matter where or if you have nitro

Step 5: Run getEmojis() , repeat every 2 lines scrolling down

Step6: Switch to stickers tab and run getStickers(), repeat every 2 lines

Step 7: When your done, run listLinks() to list all the links

Step 6: Make a folder, in that folder make a file called urls.txt and paste in links

Step 7: Open Powershell in the folder and run this to download everything in their full original size

gc urls.txt | % {iwr $_ -outf $(split-path $_ -leaf)}

Your done, I reccomend to re-disable the console panel in Discord by removing the setting and restarting Discord.

@elendil7
Copy link

elendil7 commented Jul 9, 2023

Great work my lad. Very well done.

@kidEmperors
Copy link

this doesnt seem to work, or i dont know what im doing. both are possible but either way, nothings happening

@Daud01
Copy link

Daud01 commented Feb 16, 2024

Tuning in to say this still works
1178289774340079676-Custom.png

@enzomtpYT
Copy link

tysm

@SenseiYlitka
Copy link

yoooo it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment