npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

demojijs

v1.3.6

Published

Extensively powerful API client for Discord Emoji.

Downloads

68

Readme

DEmojiJS

DiscordEmoji's number one API client for Node-based applications.

CodeFactor NPM Version NPM Weekly Downloads

1. Installation

DEmojiJS is trusted by hundreds of users from all over to power their interactions with the DiscordEmoji API. Why? It's faster thanks to its caching features, its wide array of versatile search functionalities and overall stable performance. Not convinced?

See for yourself:

If you are running a version older than v1.3.4, please update as soon as possible.

npm i demojijs@latest

1.2 Nodemon

It is possible for Nodemon users to encounter problems when adding DEmojiJS to their project, this is due to the wrapper's caching mechanism, which initializes a JSON cache store on startup, this act causes a never-ending loop where Nodemon keeps detecting a ".json" change, thereby restarting the app, which in turn causes the cache handler to yet again initialize the store, etc...

This can be easily avoided by checking that you are running the latest DEmojiJS version (look at the NPM version badge above) and then simply adding DiscordEmoji.json to the list of ignored files in the Nodemon config, like so:

"ignore": "DiscordEmoji.json"

Please refer yourself to this section of the public Nodemon repository if you don't know how to configure Nodemon.

2. Usage Examples

Often times, you won't be able to fetch a recently uploaded emote, this is not a fault of DEmojiJS; the data provided by DiscordEmoji themselves through their API is often outdated by a month or two, give or take. Most of the time, entire chunks of emotes are missing given the API doesn't serve every emote in DiscordEmoji's database.

Firstly, require DEmojiJS:

const Emoji = require("demojijs");

2.1 Packs

  • Grabbing all packs.
Emoji.Packs().then(Packs => {
    console.log(`Found ${Packs.length} packs.`);

    Packs.forEach(function(Pack) {
        console.log(`- #${Pack.id} ${Pack.name} has ${Pack.amount} emotes and can be downloaded here: ${Pack.download}`);
    });
}).catch(console.error);
// Found 8 packs.
// - #9 Pensive Emojis has 8 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/pensive-pack.zip
// - #8 Original Remixes #1 has 12 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/original-remixes-1.zip
// - #7 Blob Pack #1 has 16 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/blob-pack-1.zip
// - #6 100 Remixes has 12 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/100-remixes.zip- #5 PUBG Pack has 10 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/pubg-pack.zip
// - #4 Minecraft Pack has 16 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/minecraft-pack.zip
// - #3 Pepe Pack #1 has 16 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/pepe-pack-1.zip
// - #2 Anime Pack #1 has 16 emotes and can be downloaded here: https://discordemoji.com/assets/packs/download/anime-pack-1.zip
  • Grabbing a pack by ID, title or slug.

Input is not case-sensitive.

Emoji.Packs(4).then(console.log).catch(console.error);
Emoji.Packs("minecraft pack").then(console.log).catch(console.error);
Emoji.Packs("minecraft-pack").then(console.log).catch(console.error);

2.2 Emotes & Stats

  • Grabbing DiscordEmoji's statistics.
// Grab all statistics.
Emoji.Statistics().then(Data => {
    console.log(`DiscordEmoji has ${Data.emoji} emojis, ${Data.users} users, ${Data.faves} favorited emojis and ${Data.pending_approvals} emojis pending approval.`);
}).catch(console.error);
// DiscordEmoji has 15660 emojis, 126446 users, 103646 favorited emojis and 17 emojis pending approval.

// Grab individual statistics.
// For reference on the currently available search parameters, visit: https://discordemoji.com/api/?request=stats
// If you only want one parameter, make sure to keep it as an array rather than a string: Statistics(["users"]) not Statistics("users")
Emoji.Statistics(["users", "faves"]).then(console.log).catch(console.error);
// { users: 126468, faves: 103702 }
  • Grabbing a random emote.
// Grab a random emote.
Emoji.randomEmoji().then(console.log).catch(console.error);

// Grab a random animated (GIF) emote by simply setting "true" as the sole argument.
Emoji.randomEmoji(true).then(console.log).catch(console.error);

// Grab a random emote from a specific category by simply setting the name of the category as the sole argument.
Emoji.randomEmoji("anime").then(console.log).catch(console.error);
  • Grabbing all emotes.

Keep in mind that this will return an array if you choose to return GIFs only.

// Grab everything.
Emoji.allEmoji().then(console.log).catch(console.error);

// Grab only animated (GIF) emotes by simply setting "true" as the sole argument.
Emoji.allEmoji(true).then(Emotes => console.log(`${Emotes.length} animated emotes found.`)).catch(console.error);
  • Grabbing an emote by ID.
Emoji.emojiByID(1).then(console.log).catch(console.error);
  • Grabbing an emote by title.

Emote title is not case sensitive.

Emoji.emojiByName("kappayugi").then(console.log).catch(console.error);
  • Grabbing an emote by category.

Keep in mind that this will return an array and that the input is not case-sensitive.

For reference on all the available categories, visit: https://discordemoji.com/api/?request=categories

Emoji.emojiByCategory("anime").then(Emotes => console.log(`Found ${Emotes.length} emotes in this category.`)).catch(console.error);
// Found 1090 emotes in this category.
  • Grabbing an emote by its slug.
Emoji.emojiBySlug("5263_flashthink").then(Emote => {
    console.log(`${Emote.title}, uploaded by ${Emote.submitted_by}. => ${Emote.image}`)
}).catch(console.error);
// flashthink, uploaded by Jin. => https://discordemoji.com/assets/emoji/5263_flashthink.png
  • Grabbing emotes by author.

Keep in mind that this will return an array; also, the uploader name is not case sensitive.

  1. Grab all of the user's emotes.

    Emoji.emojiByAuthor("Jin").then(Emotes => {
        console.log(`This user has uploaded ${Emotes.length} emotes; here are a couple of them:`);
    
        Emotes.slice(-2).forEach(function(Emote) {
            console.log(`${Emote.title} => ${Emote.image}`);
        });
    }).catch(console.error);
    // This user has uploaded 90 emotes; here are a couple of them:
    // linkdab => https://discordemoji.com/assets/emoji/4955_linkdab.png
    // KappaYugi => https://discordemoji.com/assets/emoji/KappaYugi.png
  2. Grab all of the user's animated (GIF) emotes.

    // Simply set "true" as the second argument.
    Emoji.emojiByAuthor("Jin", true).then(Emotes => {
        console.log(`This user has uploaded ${Emotes.length} animated emotes; for example:`);
    
        Emotes.slice(-2).forEach(function(Emote) {
            console.log(`${Emote.title} => ${Emote.image}`);
        });
    }).catch(console.error);
    // This user has uploaded 7 animated emotes; for example:
    // linkwut => https://discordemoji.com/assets/emoji/5523_linkwut.gif
    // linklurk => https://discordemoji.com/assets/emoji/9136_linklurk.gif
  • Grabbing emotes by license.

Keep in mind that this will return an array and that the input is not case-sensitive.

Emoji.emojiByLicense("basic").then(Emotes => console.log(`Found ${Emotes.length} emotes.`)).catch(console.error);
Emoji.emojiByLicense("wtfpl").then(Emotes => console.log(`Found ${Emotes.length} emotes.`)).catch(console.error);
Emoji.emojiByLicense("cc by 4.0").then(Emotes => console.log(`Found ${Emotes.length} emotes.`)).catch(console.error);
// Found 5108 emotes.
// Found 83 emotes.
// Found 254 emotes.

// Grab animted (GIF) emotes under a certain license by setting "true" as the second argument.
Emoji.emojiByLicense("basic", true).then(Emotes => console.log(`Found ${Emotes.length} animated emotes.`)).catch(console.error);
Emoji.emojiByLicense("wtfpl", true).then(Emotes => console.log(`Found ${Emotes.length} animated emotes.`)).catch(console.error);
Emoji.emojiByLicense("cc by 4.0", true).then(Emotes => console.log(`Found ${Emotes.length} animted emotes.`)).catch(console.error);
// Found 649 animated emotes.
// Found 12 animated emotes.
// Found 36 animted emotes.

3. License

This module is publisher under the Apache 2.0 license.