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

@elara-services/leveling

v1.2.2

Published

A package for XP/Leveling on Discord.

Downloads

55

Readme

Welcome to the leveling package


Links:

Docs Docs

Discord Support

Patreon Patreon

PayPal PayPal


REQUIRED:

  • client: A v13/v14 discord.js client. (this will not work with any version below v13)
  • mongodb_uri: A mongodb connection uri. (this is for the package to save the data for servers/users/weekly)

Features:

  • [x] XP Earning
  • Messages (with custom cooldown)
  • Voice
  • Toggle for if users should be unmuted to earn XP in voice channel(s)
  • [x] Custom Levels
  • Custom messages per-level
  • Custom roles to add/remove when a use gets to that level
  • Toggle to only announced when someone reaches a registered level
  • Toggle if the level roles should stack (default: they don't)
  • [x] Weekly Leaderboard
  • Automatic announcements
  • Weekly stats for the server's messages, voice and xp
  • Weekly stats for the user's messages, level, voice and xp earned that week
  • Custom ping role(s) for when the leaderboard gets announced
  • [x] Default rank image profiles
  • Currently supported types: arcane and cavancord
  • [x] Default leaderboard images
  • Currently supported types: canvacord
  • [x] Custom XP earned
  • Min/Max XP earned for when sending messages.
  • [x] Custom cooldown for earning XP
  • [x] Custom XP Multipliers
  • Can be limited to the entire server or only certain channels/roles.
  • [x] Ignore roles/channels/users
  • [x] Level up announcements
  • Supports: DM and Channel notifications
  • Custom content/embeds for both DM and Channel notifications.
  • Toggle for pinging the user in the level up message (can be disabled per-user as well)
  • [x] Reset a user's data when they leave the server.
  • Requires the bot to have "GuildMembers" intent
  • [x] User Customization
  • stats: For any stats for the user (by default: messages, voice) but this could be added with any stats for the user (just use api.users.stats.inc)
  • background: Sets the background for the user's rank profiles.
  • colors: Sets the custom color for certain rank profiles.
  • toggles.locked: Freezes the user's data from earning XP
  • toggles.dms: Makes the bot not DM them level announcements
  • toggles.pings: Makes the bot not mention them in level announcements

Getting Started

    const { Leveling } = require("@elara-services/leveling");
    const lvls = new Leveling(client, "MONGODB_URI");
    await lvls.start(); // This will tell the package to start listening for events. 

Note: All data can be configured with lvls.api.xxx


Example API Functions:

Servers:

   const server = lvls.api.servers;

   // Get the server data.
   const serverData = await server.get("server_id");
   if (serverData.status) {
        console.log(serverData.data); // Returns the settings for the server.
   }

   // Toggle leveling on/off for a server. (by default: Leveling is off for the server)
   const data = await server.toggle("server_id", "leveling");
   console.log(data.message);

Users:

    const users = lvls.api.users;

    // Get a user's data 
    const userData = await users.get("user_id", "server_id");
    if (userData.status) {
        console.log(userData.data); // Returns the user's data for that server.
    }

Rank Profile(s):

    const data = await lvls.getRankCard("user_id", "server_id");
    // OR 
    const data = await lvls.getRankCard("user_id", "server_id", "rank_card_type"); 
    // By default the "rank_card_type" is "arcane"

    if (data.status) { // Get the rank profile image then send it to the channel
        return channel.send({
            files: [
                { 
                    name: "profile.png",
                    attachment: data.image,
                }
            ]
        });
    }

Get Leaderboard Image

    const data = await lvls.getLeaderboard("server_id");
    // OR 
    const data = await lvls.getLeaderboard(
        "server_id",
        {
            page: 1, // The page for the leaderboard image
            perPage: 5, // Up to 10 users returned in the leaderbaord image
            sort: "top", // Sort by "top" or "bottom"
            sortBy: "xp", // Sortby "xp" or "level" 
        },
        "canvacord",
        false, // If you want the weekly leaderboard, set this to: true
    )
    if (data.status) {
        // Get the leaderboard image then send it to the channel. 
        return channel.send({
            files: [
                {
                    name: "lb.png",
                    attachment: data.image,
                }
            ]
        });
    }