You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
👋 canvacord has reached v6 which comes with breaking changes, also moving away from canvas for image generation for flexibility and it means that existing examples dont really work anymore.
Here is an example on how use builtin xp card builder in v6. While I am not familiar with discord.js, this example is based on the previous example mentioned in this repository.
const{ RankCardBuilder, Font }=require('canvacord');// place it outside of the command functionFont.loadDefault();// or load your own font!consttarget=message.mentions.users.first()||message.author;// Grab the target.constuser=awaitLevels.fetch(target.id,message.guild.id,true);// Selects the target from the database.constrank=newRankCardBuilder()// Build the Rank Card.setAvatar(target.displayAvatarURL({format: 'png',size: 512})).setCurrentXP(user.cleanXp)// Current User Xp for the current level.setRequiredXP(user.cleanNextLevelXp)//The required Xp for the next level.setRank(user.position)// Position of the user on the leaderboard.setLevel(user.level)// Current Level of the user.setUsername(target.username).setDisplayName(target.displayName);rank.build({format: 'png'}).then(data=>{// consume the image});
For flexibility, canvacord now has setProgressCalculator to determine the width of the progress bar.
.setProgressCalculator(()=>{returnMath.floor(Math.random()*100);// return random width (0-100)})
The text was updated successfully, but these errors were encountered:
👋 canvacord has reached v6 which comes with breaking changes, also moving away from canvas for image generation for flexibility and it means that existing examples dont really work anymore.
Here is an example on how use builtin xp card builder in v6. While I am not familiar with discord.js, this example is based on the previous example mentioned in this repository.
For flexibility, canvacord now has setProgressCalculator to determine the width of the progress bar.
The text was updated successfully, but these errors were encountered: