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