メインコンテンツまでスキップ

addLevel()

This function is used to add levels to a user.

When the user's level actually changes, this function also triggers XpEvents callbacks (levelUp / levelDown) and awaits them before resolving.

Parameters

ParameterTypeRequiredDescription
userIdstringThe ID of the user.
guildIdstringThe guild ID.
levelnumberThe amount of levels to add.
usernamestringThe name of user.

Returns

Throws

  • XpFatal - if invalid parameters are provided.

[JS] Example

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

const userid = "770551872309166090";
const guildid = "867999056172052551";
const level = 69;
const username = "Rahuletto";

addLevel(userid, guildid, level, username)
.then(console.log) // Returns the user object
.catch((err) => console.log(err)); // Returns the error