@ienznotfound/generateuserlevelupandprofiles
v1.0.405
Published
<div align="center"> <h1>π Generate User Level Up & Profiles</h1> <p><strong>A powerful, highly customizable, and aesthetic Canvas generator for Discord Bot Profile and Level-Up Cards.</strong></p> </div>
Readme
Create stunning, high-resolution user profile cards and level-up notifications with zero CSS/HTML required. Built purely on @napi-rs/canvas for blazing fast performance, featuring automatic emoji support, auto-scaling text, and an integrated image uploader!
β¨ Features
- π¨ Premium Aesthetic UI: Features a beautiful floating glassmorphism card over your background image, complete with drop shadows and rounded corners.
- β¨ Neon Gradients: Avatar borders and progress bars use vibrant linear gradients with glowing neon shadows for a futuristic Discord bot feel.
- πΌοΈ Auto-Circular Avatars: Pass any image URL, and we'll automatically crop it into a perfect circle with a gradient border.
- π Auto-Scaling Text: Never worry about long usernames! Text automatically scales down to fit the canvas perfectly without overflowing.
- π Native Emoji Support: Out-of-the-box support for OS emojis (
Segoe UI Emoji,Apple Color Emoji,Noto Color Emoji). - βοΈ Built-in Auto Uploader (Optional): Want to save bandwidth? Use
.uploadOptions('uploader')to directly upload the generated image touguu.se(with fallback tocatbox.moe) and get a direct URL string back!
π¦ Installation
Install via npm:
npm install @ienznotfound/generateuserlevelupandprofilesπ Quick Start & Examples
1. πͺͺ Generating a Profile Card
The profiles class is designed to show a user's current rank, level, and EXP progress.
const fs = require('fs');
const { profiles } = require('@ienznotfound/generateuserlevelupandprofiles');
async function buildProfile() {
const profileImageBuffer = await new profiles()
// 1. Set the background (URL or Local Path)
.addBackground('https://example.com/aesthetic-bg.png')
// 2. Set the user's avatar
.addAvatar('https://example.com/user-avatar.jpg')
// 3. Set the Level Number (Automatically formats to "Level X")
.addLevel(42)
// 4. Set the EXP Tracker Text
.addCurrentExp('EXP : 7,500 / 10,000')
// 5. Draw the Progress Bar (Provide a percentage from 0 to 100)
.addProgressBar(75)
// 6. Generate the image as a Local Buffer (Default)
.uploadOptions('local')
.generate();
// Save or send the buffer directly to Discord!
fs.writeFileSync('my-profile.png', profileImageBuffer);
console.log('Profile card saved successfully!');
}
buildProfile();2. π Generating a Level-Up Card (With Auto Uploader)
The levelup class is tailored for congratulatory messages when a user levels up.
In this example, we use the uploader option to instantly get a web URL instead of a Buffer!
const { levelup } = require('@ienznotfound/generateuserlevelupandprofiles');
async function buildLevelUp() {
try {
const uploadedImageUrl = await new levelup()
.addBackground('https://example.com/epic-bg.png')
.addAvatar('https://example.com/user-avatar.jpg')
// Custom Congratulations Text
.addLevelUpText('π Selamat! Kamu Naik Ke Level 43! π₯³')
// EXP Tracker Text
.addProgress('EXP: 0 / 15,000')
// Level Transition (Before -> Now)
.addLevelTransition(42, 43)
// Magic happens here! Instead of returning a Buffer, it uploads to Uguu/Catbox.
.uploadOptions('uploader')
.generate();
// Output is a direct image URL!
console.log('Image successfully uploaded to:', uploadedImageUrl);
// e.g., https://n.uguu.se/xxxxxx.png
} catch (error) {
console.error('Failed to generate or upload card:', error);
}
}
buildLevelUp();π API Reference
π οΈ Shared Core Methods
These methods are available on both profiles and levelup classes.
| Method | Argument Type | Description |
|--------|--------------|-------------|
| .addBackground(src) | String | URL or absolute local file path to the background image. The image will automatically scale to cover the 800x250 canvas with an aesthetic dark overlay. |
| .addAvatar(src) | String | URL or absolute local file path to the user's avatar. It will be cropped into a circle. |
| .addProgressBar(pct)| Number | Draws a sleek progress bar. pct should be a number between 0 and 100 representing the percentage. |
| .uploadOptions(type)| String | Determines the output type of .generate(). Pass 'local' to return a raw Buffer. Pass 'uploader' to automatically POST the image to Uguu.se/Catbox.moe and return the URL String. Default is 'local'. |
| .generate() | none | Asynchronously builds the canvas and returns either a Buffer or a String (based on uploadOptions). |
πͺͺ profiles Specific Methods
| Method | Argument Type | Description |
|--------|--------------|-------------|
| .addLevel(number) | Number/String| Sets the primary title on the card (Automatically prepends "Level "). |
| .addCurrentExp(text)| String | Sets the secondary text below the progress bar (e.g. "EXP : 500/1000"). |
π levelup Specific Methods
| Method | Argument Type | Description |
|--------|--------------|-------------|
| .addLevelUpText(text)| String | Sets the primary title on the card. Allows custom congratulatory text. |
| .addProgress(text) | String | Sets the secondary text below the progress bar. |
| .addLevelTransition(before, now) | Number/String | Draws a sleek "Level Before β Level Now" transition (e.g. 1 β 2) instead of a progress bar. |
