Skip to main content
Version: v1

addXP()

This function is used to add experience to a user.

Parameters​

ParameterTypeRequiredDescription
messageMessageβœ…The message object.
userIdstringβœ…The User ID
guildIdstringβœ…The Guild ID
xpnumber
{min, max}
βœ…Amount of XP to add.

Returns​

  • Promise<{ level: number, xp: number }>

Throws​

  • new Error() - if invalid parameters are provided.

[JS] Example​

const {addXP} = require("simply-xp");

const userid = "770551872309166090";
const guildid = "867999056172052551";
const xp = 10000000; // or xp = {min: 5000000, max: 10000000}

addXP(message, userid, guildid, xp)
.then(console.log) // Returns the updated level and xp
.catch((err) => console.log(err)); // Returns the error