Profile
Level
The `level` command displays a user's level and XP progress with a premium visual level card. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Command Details
- Name: level
- Aliases: lvl, xp, id
- Category: Profile
- Description: Displays your level and XP progress
- Usage:
P level [@user]
,p level [@user]
, or/level [@user]
- Examples:
P level
p lvl @JohnDoe
/level
- Cooldown: 5 seconds
- Arguments: user (optional)
- Slash Command: Disabled
- Permissions:
- Bot: SendMessages, ViewChannel, EmbedLinks, AttachFiles
- User: None
- Player Requirements: None (no voice, DJ, or active player required)
Functionality
- Generates premium visual level cards with custom wallpapers and colors.
- Canvas Generation: Creates 1280x720 pixel level cards using @napi-rs/canvas.
- Custom Fonts: Uses Ghibli and Ghibli-Bold fonts for premium styling.
- Wallpaper Support: Displays equipped wallpapers or default backgrounds.
- Color Themes: Applies equipped color schemes for personalized appearance.
- Progress Visualization: Shows XP progress with enhanced progress bars and percentage display.
- Dual XP Systems: Displays both text XP and voice XP with separate progress bars.
- Level Badges: Premium circular badges showing current text and voice levels.
- Avatar Integration: Renders user avatars with premium frames and effects.
- Loading Animation: Shows animated loading message during card generation.
- Error Handling: Graceful error recovery with fallback messages.
- Target User Support: Can view other users' level cards by mentioning them.
Code Overview
The command is built using a Command
class structure and handles both message-based and interaction-based (slash command) inputs. It uses:
createCanvas(1280, 720)
to generate high-resolution level cards.GlobalFonts.registerFromPath()
to load custom Ghibli fonts.ShopItems
inventory system to fetch equipped wallpapers and color themes.client.utils.getUser()
to retrieve user profile data and XP information.loadImage()
for banner and avatar image processing with error handling.AttachmentBuilder
to create Discord file attachments from canvas buffers.- Complex drawing functions including
drawStreamlinedLevel()
for card rendering. - Premium visual effects: glass effects, rounded rectangles, gradient fills, and shadows.
- Enhanced progress bars with milestone markers and animated elements.
- Avatar frame rendering with premium borders and shine effects.
- Multi-stage loading process with 2.8-second animated GIF display.
- Error handling for image loading, canvas operations, and database queries.
- Fallback systems for missing wallpapers, colors, and user data.
Gender
The `gender` command allows users to set, view, or reset their gender preference in their profile. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.
Profile
The `profile` command displays comprehensive user profile information with custom visual cards and special themes. It can be triggered using the prefixes `P`, `p`, or the slash command `/`.