Skip to content
Version: v1.4
On this page

rank()

This function is used to generate an image of a user’s rank.

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.
  • Promise<{ attachment: Buffer, description: string, name: string } | undefined>

Image

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.

  • new Error() - if the user ID or guild ID is missing.
  • new Error() - NO_DATA, if the user has no record.
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 error

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.