So im trying to get the about me section on a users profile and then putting it on a node canvas didn't find a document on the discordjs so just checking if its even possible
my code for the profile canvas:
const Discord = require('discord.js')
const Canvas = require('canvas');
const client = new Discord.Client({
intents: ['DIRECT_MESSAGES', 'GUILD_MESSAGES', 'GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGE_REACTIONS', 'GUILD_VOICE_STATES', 'GUILD_PRESENCES']
});
const applyText = (canvas, text) => {
const context = canvas.getContext('2d');
let fontSize = 70;
do {
context.font = `${fontSize -= 10}px sans-serif`;
} while (context.measureText(text).width > canvas.width - 300);
return context.font;
};
client.on('messageCreate', async message => {
if (message.author.bot) return;
if (message.channel.type === 'dm') return;
if (!prefix[message.guild.id]) return;
if (!langs[message.author.id]) return;
if (message.content.toLowerCase().startsWith(prefix[message.guild.id].custprefix + 'profile')) {
const canvas = Canvas.createCanvas(700, 250);
const context = canvas.getContext('2d');
const background = await Canvas.loadImage('./profiles/backround.jpg');
context.drawImage(background, 0, 0, canvas.width, canvas.height);
context.strokeStyle = '#34eb6e';
context.strokeRect(0, 0, canvas.width, canvas.height);
context.font = applyText(canvas, message.author.username);
context.fillStyle = '#ffffff';
context.fillText(message.author.username, canvas.width / 2.5, canvas.height / 3.8);
context.beginPath();
context.arc(125, 125, 100, 0, Math.PI * 2, true);
context.closePath();
context.clip();
const avatar = await Canvas.loadImage(message.author.displayAvatarURL({ dynamic: true, format: jpg }));
context.drawImage(avatar, 25, 25, 200, 200);
const attachment = new Discord.MessageAttachment(canvas.toBuffer(), 'profile-image.png');
message.channel.send({ files: [attachment] })
}
})