I have recently began making a level system using canvacord, and all was going good until I got an error with the image source? I don’t understand what that is or what I means, last time I worked with canvacord that was never an issue so I don’t know what’s going on but I have shown the code and error below.
Code:
const { EmbedBuilder, AttachmentBuilder } = require('discord.js');
const canvacord = require('canvacord');
const Levels = require('discord-xp');
module.exports = {
name: 'rank',
aliases: ['level'],
description: "Returns a users level within a server.",
usage: "<user>",
run: async (client, message, args) => {
const target = message.mentions.users.first() || message.author;
const user = await Levels.fetch(target.id, message.guild.id, true);
const rank = new canvacord.Rank()
.setAvatar({ iconURL: target.displayAvatarURL({ format: 'png', size: 512 }) })
.setCurrentXP(user.xp)
.setRequiredXP(Levels.xpFor(user.level + 1))
.setRank(user.position)
.setLevel(user.level)
.setProgressBar("#FFFFFF")
.setUsername(target.username)
.setDiscriminator(target.discriminator);
rank.build().then(data => {
const attachment = new AttachmentBuilder(data, { name: 'CrimsonRankCard.png' });
message.channel.send({ files: [attachment] });
});
}
}
Error:
TypeError: unsupported image source