setFlags
On this page
setFlags()
This function stores flags on a user record.
Flags are persisted in the user data and can be consumed by your own logic or plugins. Pass undefined to remove all stored flags from the user.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| userId | string | ✅ | The ID of the user. |
| guildId | string | ✅ | The guild ID. |
| flags | Array | ❌ | String/number flags to store. Use undefined to remove flags. |
| username | string | ❌ | Username to use if auto_create is enabled. |
Returns
Section titled “Returns”- Promise<
UserResult>
Throws
Section titled “Throws”XpFatal- if invalid parameters are provided, or if there is a database error.
[JS] Example
Section titled “[JS] Example”const { setFlags } = require("simply-xp");
const userid = "326815959358898189";const guildid = "867999056172052551";const flags = ["modified", "illegal"];const username = "Abadima";
setFlags(userid, guildid, flags, username) .then(console.log) // Returns the user object .catch((err) => console.log(err)); // Returns the error