
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
milo-leveling
Advanced tools
$ npm install --save discord-leveling
Checkout my package for economy systems on discord bots! discord-economy
npm install --save sequelize)npm install --save sqlite3)npm install --save discord.js)npm install --save discord.js-commando)npm install --save eris)SetXp
/**
* @param {string} [UserID] - Somebody's discord user ID.
* @param {integer} [toSet] - How much xp you want the user to have.
*/
var leveling = require('discord-leveling')
leveling.SetXp(UserID, toSet)
/**
Expected Promise Output
{userid, xp}
*/
SetLevel
/**
* @param {string} [UserID] - Somebody's discord user ID.
* @param {integer} [toSet] - How much levels you want the user to have.
*/
var leveling = require('discord-leveling')
leveling.SetLevel(UserID, toSet)
/**
Expected Promise Output
{userid, level}
*/
AddXp
/**
* @param {string} [UserID] - Somebody's discord user ID.
* @param {integer} [toAdd] - How much xp you want to add.
*/
var leveling = require('discord-leveling')
leveling.AddXp(UserID, toAdd)
/**
Expected Promise Output
{userid, oldxp, newxp}
*/
AddLevel
/**
* @param {string} [UserID] - Somebody's discord user ID.
* @param {integer} [toAdd] - How much levels you want to add.
*/
var leveling = require('discord-leveling')
leveling.AddLevel(UserID, toAdd)
/**
Expected Promise Output
{userid, oldlevel, newlevel}
*/
Leaderboard
/**
* @param {Object} data - The data you want to attach to the function.
All keys in this object are optional.
* @param {integer} data.limit - Limit how much users to fetch.
* @param {string} data.search - Search the placement of a user in leaderboard.
*/
var leveling = require('discord-leveling')
leveling.Leaderboard({limit: NUMBER, search: 'UserID'})
/**
Expected Promise Output without data.search
[ {userid, level, xp}, {userid, level, xp}, {userid, level, xp} ]
array[0] is the first place of the leaderboard. array[1] second etc.
*/
/**
Expected Promise Output with data.search
{userid, placement}
*/
Fetch
/**
* @param {string} [UserID] - Somebody's discord user ID.
*/
var leveling = require('discord-leveling')
leveling.Fetch(UserID)
/**
Expected Promise Output
{userid, xp, level}
*/
Delete
/**
* @param {string} [UserID] - Somebody's discord user ID.
*/
var leveling = require('discord-leveling')
leveling.Delete(UserID)
/**
Expected Promise Output
{deleted}
*/
/*
If you want to make discord-leveling guild based you have to use message.author.id + message.guild.id as ID for example:
leveling.AddLevel(message.author.id + message.guild.id, toAdd).then(l => console.log(l))
This will create an unique ID for each guild member
*/
//Requiring Packages
const Discord = require('discord.js'); //This can also be discord.js-commando or other node based packages!
const leveling = require('./app.js');
//Create the bot client
const client = new Discord.Client();
//Set the prefix and token of the bot.
const settings = {
prefix: ';',
token: 'YOUR TOKEN'
}
//Whenever someone types a message this gets activated.
//(If you use 'await' in your functions make sure you put async here)
client.on('message', async message => {
//This reads the first part of your message behind your prefix to see which command you want to use.
var command = message.content.toLowerCase().slice(settings.prefix.length).split(' ')[0];
//These are the arguments behind the commands.
var args = message.content.split(' ').slice(1);
//If the user that types a message is a bot account return.
if (message.author.bot) return;
//When someone sends a message add xp
var profile = await leveling.Fetch(message.author.id)
leveling.AddXp(message.author.id, 10)
//If user xp higher than 100 add level
if (profile.xp + 10 > 100) {
await leveling.AddLevel(message.author.id, 1)
await leveling.SetXp(message.author.id, 0)
message.reply(`You just leveled up!! You are now level: ${profile.level + 1}`)
}
//If the message does not start with your prefix return.
if (!message.content.startsWith(settings.prefix)) return;
if (command === 'profile') {
var user = message.mentions.users.first() || message.author
var output = await leveling.Fetch(user.id)
message.channel.send(`Hey ${user.tag}! You have ${output.level} level(s)! and ${output.xp} xp!`);
}
if (command === 'setxp') {
var amount = args[0]
var user = message.mentions.users.first() || message.author
var output = await leveling.SetXp(user.id, amount)
message.channel.send(`Hey ${user.tag}! You now have ${amount} xp!`);
}
if (command === 'setlevel') {
var amount = args[0]
var user = message.mentions.users.first() || message.author
var output = await leveling.SetLevel(user.id, amount)
message.channel.send(`Hey ${user.tag}! You now have ${amount} levels!`);
}
if (command === 'leaderboard') {
//If you put a mention behind the command it searches for the mentioned user in database and tells the position.
if (message.mentions.users.first()) {
var output = await leveling.Leaderboard({
search: message.mentions.users.first().id
})
message.channel.send(`The user ${message.mentions.users.first().tag} is number ${output.placement} on my leaderboard!`);
//Searches for the top 3 and outputs it to the user.
} else {
leveling.Leaderboard({
limit: 3 //Only takes top 3 ( Totally Optional )
}).then(async users => { //make sure it is async
if (users[0]) var firstplace = await client.fetchUser(users[0].userid) //Searches for the user object in discord for first place
if (users[1]) var secondplace = await client.fetchUser(users[1].userid) //Searches for the user object in discord for second place
if (users[2]) var thirdplace = await client.fetchUser(users[2].userid) //Searches for the user object in discord for third place
message.channel.send(`My leaderboard:
1 - ${firstplace && firstplace.tag || 'Nobody Yet'} : ${users[0] && users[0].level || 'None'} : ${users[0] && users[0].xp || 'None'}
2 - ${secondplace && secondplace.tag || 'Nobody Yet'} : ${users[1] && users[1].level || 'None'} : ${users[0] && users[0].xp || 'None'}
3 - ${thirdplace && thirdplace.tag || 'Nobody Yet'} : ${users[2] && users[2].level || 'None'} : ${users[0] && users[0].xp || 'None'}`)
})
}
}
if (command == 'delete') { //You want to make this command admin only!
var user = message.mentions.users.first()
if (!user) return message.reply('Please specify a user I have to delete in my database!')
if (!message.guild.me.hasPermission(`ADMINISTRATION`)) return message.reply('You need to be admin to execute this command!')
var output = await leveling.Delete(user.id)
if (output.deleted == true) return message.reply('Succesfully deleted the user out of the database!')
message.reply('Error: Could not find the user in database.')
}
})
//Your secret token to log the bot in. (never show this to anyone!)
client.login(settings.token)
FAQs
New and Easy discord leveling framework. Made with Sequelize.
We found that milo-leveling demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.