rankVersion: v1.4
On this page
rank()
This function is used to generate an image of a user’s rank.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| message | Message | ✅ | The message object. |
| userId | string | ✅ | The ID of the user. |
| guildId | string | ✅ | The guild ID. |
| options | RankCardOptions | ❌ | The options. |
Returns
Section titled “Returns”- Promise<
{ attachment: Buffer, description: string, name: string } | undefined>

The attachment is a WebP image named rank.png. If the card cannot be drawn (the member is not in the cache, or an image cannot be loaded), the error is logged and the promise resolves undefined.
Throws
Section titled “Throws”new Error()- if the user ID or guild ID is missing.new Error()-NO_DATA, if the user has no record.
[JS] Example
Section titled “[JS] Example”const { rank } = require("simply-xp");
const userId = "326815959358898189";const guildId = "867999056172052551";
rank(message, userId, guildId) .then((card) => message.reply({ files: [card] })) // Send the card .catch((err) => console.log(err)); // Returns the errorRank Options
Section titled “Rank Options”| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| background | URL | ❌ | gradient | The background image. |
| color | HEX | ❌ | #096DD1 | The theme color. |
| lvlbar | HEX | ❌ | #ffffff | The color of the level bar. |
| lvlbarBg | HEX | ❌ | #ffffff | The color of the level bar’s background. |