fetch
On this page
fetch()
This function is used to fetch a user from the database.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | The ID of the user. |
| guildId | string | ✅ | The guild ID of the user. |
| username | string | ❌ | Username to use if auto_create is enabled |
Returns
Section titled “Returns”- Promise<
User>
Throws
Section titled “Throws”XpFatal- if invalid parameters are provided.
[JS] Example
Section titled “[JS] Example”const {fetch} = require('simply-xp');
const userId = "326815959358898189";const guildId = "867999056172052551";const username = "Abadima";
fetch(userId, guildId, username) .then(console.log) // Returns the user object .catch((err) => console.log(err)); // Returns the error