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 🙏

© 2025 – Pkg Stats / Ryan Hefner

trixxy-leveling

v1.0.0

Published

A Discord leveling system with image generation for Trixxy projects.

Downloads

9

Readme

trixxy-leveling

A powerful and customizable Discord leveling system with image generation capabilities, built for Trixxy projects.

Features

  • Automatic XP Gain: Users gain XP by sending messages.
  • Customizable Leveling Formula: Adjust how much XP is needed for each level.
  • Dynamic Level Cards: Generate beautiful level cards with user avatars, XP, and level progress.
  • Customizable Messages: Set your own level-up messages.
  • Flexible Configuration: Easily change background, font color, and progress bar color.

Installation

npm install trixxy-leveling

Usage

Basic Setup

const { Client, GatewayIntentBits } = require('discord.js');
const TrixxyLeveling = require('trixxy-leveling');

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
    ],
});

const leveling = new TrixxyLeveling({
    client: client, // Your Discord.js client
    background: 'https://example.com/your-custom-background.png', // Optional: URL to a custom background image
    fontColor: '#FFD700', // Optional: Hex color for text
    progressBarColor: '#00FFFF', // Optional: Hex color for the progress bar
    levelUpMessage: 'Well done, {user}! You've reached level {level}!', // Optional: Custom level up message
    xpPerMessage: 15, // Optional: XP gained per message (default is 10)
    levelFormula: (level) => 10 * Math.pow(level, 2) + 100 * level + 200, // Optional: Custom XP formula
});

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.login('YOUR_BOT_TOKEN');

// Example command to show a user's level card
client.on('messageCreate', async message => {
    if (message.author.bot) return;
    if (message.content === '!level') {
        const userData = leveling.getUserData(message.author.id, message.guild.id);
        const attachment = await leveling.generateLevelCard(message.author, userData.xp, userData.level);
        message.channel.send({ files: [attachment] });
    }
});

TrixxyLeveling Class

Constructor Options

  • client (required): Your Discord.js client instance. Used to listen for messageCreate events.
  • background (optional): String URL to a custom background image for the level card. Default is a placeholder image.
  • fontColor (optional): String Hex color code for the text on the level card. Default is #ffffff.
  • progressBarColor (optional): String Hex color code for the progress bar on the level card. Default is #00ff00.
  • levelUpMessage (optional): String Custom message sent when a user levels up. Supports {user} and {level} placeholders. Default is 'Congratulations, {user}! You leveled up to level {level}!'.
  • xpPerMessage (optional): Number Amount of XP a user gains per message. Default is 10.
  • levelFormula (optional): Function A function that takes the current level as an argument and returns the required XP for that level. Default is (level) => 5 * Math.pow(level, 2) + 50 * level + 100.

Methods

  • handleMessage(message): (Internal) Processes incoming messages to award XP and check for level-ups. Automatically called if client is provided in the constructor.
  • generateLevelCard(user, currentXp, currentLevel): Async Function Generates a level card image for the specified user. Returns a Discord.js AttachmentBuilder.
    • user: A Discord.js User object.
    • currentXp: Number The user's current XP.
    • currentLevel: Number The user's current level.
  • getUserData(userId, guildId): Returns an object { xp: Number, level: Number } for the specified user and guild. If no data exists, returns { xp: 0, level: 0 }.
  • setUserData(userId, guildId, data): Sets the XP and level data for a specific user in a guild.

Requirements

  • Node.js v16.6.0 or higher
  • discord.js v14 or higher
  • canvas library requires some system dependencies. Please refer to the canvas documentation for installation instructions for your operating system.

Contributing

Feel free to open issues or submit pull requests.

License

This project is licensed under the MIT License.