Aller au contenu
Version: v1.4
Sur cette page

setXP()

Ce contenu n’est pas encore disponible dans votre langue.

This function is used to set the user’s experience in the database.

Parameter Type Required Description
userId string ✅ The User ID
guildId string ✅ The Guild ID
xp number ✅ The XP to set.
  • Promise<{ xp: number, level: number }>
  • new Error() - if the user ID or guild ID is missing, or the amount is not a finite number (Invalid XP amount).
  • Rejects if the database write fails.
const { setXP } = require("simply-xp");
const userId = "770551872309166090";
const guildId = "867999056172052551";
const xp = 1000;
setXP(userId, guildId, xp)
.then(console.log) // Returns the updated xp and level
.catch((err) => console.log(err)); // Returns the error