Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@elara-services/leveling) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Welcome to the leveling package
Links:
Docs
Support
Patreon
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:
- XP Earning
- Messages (with custom cooldown)
- Voice
- Toggle for if users should be unmuted to earn XP in voice channel(s)
- 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)
- Weekly Leaderboard
- Automatic announcements
- Weekly stats for the server's
messages,voiceandxp - Weekly stats for the user's
messages,level,voiceandxpearned that week - Custom ping role(s) for when the leaderboard gets announced
- Default rank image profiles
- Currently supported types:
arcaneandcavancord - Default leaderboard images
- Currently supported types:
canvacord - Custom XP earned
- Min/Max XP earned for when sending messages.
- Custom cooldown for earning XP
- Custom XP Multipliers
- Can be limited to the entire server or only certain channels/roles.
- Ignore roles/channels/users
- 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)
- Reset a user's data when they leave the server.
- Requires the bot to have "GuildMembers" intent
- 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 useapi.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 XPtoggles.dms: Makes the bot not DM them level announcementstoggles.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,
}
]
});
}