🪄
Canvacard
  • 🥳Welcome
  • 🗂️Classes
    • 🎨Welcome / Leave
    • 🎮FortniteShop
    • 🎯Canvacard
    • 🎶Spotify
    • 🏆Rank
    • 🖋️Plugins
  • 🧰Utils
    • 🔧Abbreviate
    • 🖼️Canvas
    • 🕒Discord Time
    • ⚠️Error
    • 🏳️Flags
    • 🔍Format and Validate Hex
    • ⏰Format Time
    • 📏Format Variable
    • 📅Get Date or String
    • 🔍Icon
    • 🔢Is Number
    • 🔤Is String
    • 🖼️Parse Image
    • 📄Parse PNG
    • 📄Parse SVG
    • 🔽Shorten
    • ✂️Truncate Text
    • 👤Username
Powered by GitBook
On this page
  • Classes
  • Functions
  • Rank
  • setAvatar(avatarUrl, AvatarDecorationData, squareAvatar) ⇒ Rank
  • setBanner(bannerUrl, moreBackgroundBlur, disableBackgroundBlur, backgroundBrightness) ⇒ Rank
  • setBadges(flags, bot, frame, customBadges) ⇒ Rank
  • setBorder(color, allign) ⇒ Rank
  • setUsername(name, [discriminator], [color], [customUsername], [customTag]) ⇒ Rank
  • setCurrentXP(data, [color]) ⇒ Rank
  • setRequiredXP(data, [color]) ⇒ Rank
  • setRank(data, [text], [display]) ⇒ Rank
  • setLevel(data, [text]) ⇒ Rank
  • setProgressBar(color, [fillType], [rounded]) ⇒ Rank
  • setStatus(presenceStatus) ⇒ Rank
  • setCreatedTimestamp(timestamp, customDate) ⇒ Rank
  • build([font]) ⇒ Promise.<Buffer>
  1. Classes

Rank

PreviousSpotifyNextPlugins

Last updated 5 months ago

Classes

Functions

⇒

Set the user avatar

⇒

Set the user banner

⇒

Set the user badges and frame

⇒

Set the border of the card

⇒

Set the username of the user

⇒

Set the current experience

⇒

Set the required experience

Set the user rank

Establece el nivel del usuario

Set the progress bar

Set the user presence status

Set the user created timestamp

Build the rank card

Rank

Kind: global class

new Rank(userId)

Rank card creator

PREVIEW
Param
Type
Description

userId

string

User ID

Example

const rank = new canvacard.Rank(data.id)
  .setAvatar(data.avatarURL, data.avatar_decoration_data.asset)
  .setBanner(data.bannerURL, true)
  .setBadges(data.flags, data.bot, true)
  .setBorder(["#22274a", "#001eff"], "vertical")
  .setCurrentXP(userData.xp)
  .setRequiredXP(userData.requiredXP)
  .setRank(1, "RANK", true)
  .setLevel(20, "LEVEL", true)
  .setStatus("online")
  .setProgressBar(["#14C49E", "#FF0000"], "GRADIENT", true)
  .setUsername(data.global_name, data.discriminator)
  .setCreatedTimestamp(data.createdTimestamp);

const rankImage = await rank.build("Cascadia Code PL");
canvacard.write(rankImage, "./rank.png");

Set the user avatar

  • APIError If the URL or asset is invalid

Param
Type
Description

avatarUrl

string

Avatar URL

AvatarDecorationData

string

Avatar decoration asset

squareAvatar

boolean

Square avatar

Set the user banner

  • APIError If the URL or asset is invalid

Param
Type
Description

bannerUrl

string

Banner URL

moreBackgroundBlur

boolean

More background blur

disableBackgroundBlur

boolean

Disable background blur

backgroundBrightness

number

Background brightness

Set the user badges and frame

  • APIError If the URL or asset is invalid

Param
Type
Description

flags

number

User flags

bot

boolean

Whether the user is a bot or not

frame

boolean

Badge frame

customBadges

Array.<string>

Custom badges

Set the border of the card

  • APIError If the URL or asset is invalid

Param
Type
Description

color

string | Array.<string>

HEX color of the border, can be gradient if 2 colors are used

allign

string

Gradient alignment if 2 colors are used

Set the username of the user

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

name

string

Username of the user

[discriminator]

string

"&quot;0&quot;"

Discriminator of the user

[color]

string

"&quot;#FFFFFF&quot;"

Color of the username

[customUsername]

string

null

Custom username

[customTag]

string

null

Custom tag

Set the current experience

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

data

number

Current experience data

[color]

string

"&quot;#FFFFFF&quot;"

Text color

Set the required experience

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

data

number

Required experience data

[color]

string

"&quot;#FFFFFF&quot;"

Text color

Set the user rank

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

data

number

Rank data

[text]

string

"&quot;RANK&quot;"

Display text

[display]

boolean

false

Display system rank or not

Establece el nivel del usuario

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

data

number

Level data

[text]

string

"&quot;LEVEL&quot;"

Display text

Set the progress bar

  • APIError If the URL or asset is invalid

Param
Type
Default
Description

color

string | Array.<string>

Color of the progress bar, can be gradient if 2 colors are used

[fillType]

string

"&quot;COLOR&quot;"

Type of progress bar

[rounded]

boolean

true

Rounded corners of the progress bar

Set the user presence status

  • APIError If the URL or asset is invalid

Param
Type
Description

presenceStatus

string

Presence status

Set the user created timestamp

  • APIError If the URL or asset is invalid

Param
Type
Description

timestamp

number

Timestamp of when the user joined Discord

customDate

string | Date

Custom date format for the timestamp

build([font]) ⇒ Promise.<Buffer>

Build the rank card

Kind: global function Returns: Promise.<Buffer> - Card image in buffer format Throws:

  • APIError Missing field: data

Param
Type
Default
Description

[font]

string

"&quot;Arial&quot;"

Font to use in the card

⇒

⇒

⇒

⇒

⇒

⇒ Promise.<Buffer>

setAvatar(avatarUrl, AvatarDecorationData, squareAvatar) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setBanner(bannerUrl, moreBackgroundBlur, disableBackgroundBlur, backgroundBrightness) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setBadges(flags, bot, frame, customBadges) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setBorder(color, allign) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setUsername(name, [discriminator], [color], [customUsername], [customTag]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setCurrentXP(data, [color]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setRequiredXP(data, [color]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setRank(data, [text], [display]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setLevel(data, [text]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setProgressBar(color, [fillType], [rounded]) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setStatus(presenceStatus) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

setCreatedTimestamp(timestamp, customDate) ⇒

Kind: global function Returns: - The current instance of Rank Throws:

🗂️
🏆
Rank
setAvatar(avatarUrl, AvatarDecorationData, squareAvatar)
Rank
setBanner(bannerUrl, moreBackgroundBlur, disableBackgroundBlur, backgroundBrightness)
Rank
setBadges(flags, bot, frame, customBadges)
Rank
setBorder(color, allign)
Rank
setUsername(name, [discriminator], [color], [customUsername], [customTag])
Rank
setCurrentXP(data, [color])
Rank
setRequiredXP(data, [color])
Rank
setRank(data, [text], [display])
Rank
setLevel(data, [text])
Rank
setProgressBar(color, [fillType], [rounded])
Rank
setStatus(presenceStatus)
Rank
setCreatedTimestamp(timestamp, customDate)
Rank
build([font])
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank
Rank