fetchVersion: v1.2
Sur cette page
fetch()
Ce contenu n’est pas encore disponible dans votre langue.
This function is used to fetch a user from the database. A user that has no record yet is created at 0 XP.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | The ID of the user. |
| guildId | string | ✅ | The guild ID of the user. |
Returns
Section titled “Returns”- Promise<
object>
Example:
{ level: 1, xp: 150, reqxp: 400, // XP needed for the next level rank: 1, shortxp: "150", shortreq: "400"}Throws
Section titled “Throws”new Error()- if the user ID or guild ID is missing.
[JS] Example
Section titled “[JS] Example”const { fetch } = require("simply-xp");
const userId = "326815959358898189";const guildId = "867999056172052551";
fetch(userId, guildId) .then(console.log) // Returns the user's numbers .catch((err) => console.log(err)); // Returns the error