setXPVersion: v1.4
目次
setXP()
このコンテンツはまだ日本語訳がありません。
This function is used to set the user’s experience in the database.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | The User ID |
| guildId | string | ✅ | The Guild ID |
| xp | number | ✅ | The XP to set. |
Returns
Section titled “Returns”- Promise<
{ xp: number, level: number }>
Throws
Section titled “Throws”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.
[JS] Example
Section titled “[JS] Example”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