setXP()
This function is used to set the user's experience in the database.
Parametersβ
Parameter | Type | Required | Description |
---|---|---|---|
message | Message | β | The message object. |
userId | string | β | The User ID |
guildId | string | β | The Guild ID |
xp | number | β | Amount of XP to set. |
Returnsβ
- Promise<
{ level: number, xp: number }
>
Throwsβ
new Error()
- if invalid parameters are provided.
[JS] Exampleβ
const {setXP} = require("simply-xp");
const userid = "770551872309166090";
const guildid = "867999056172052551";
const xp = 10000000;
setXP(message, userid, guildid, xp)
.then(console.log) // Returns the updated level and xp
.catch((err) => console.log(err)); // Returns the error