Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.run = async () => {
- const Canvas = require('canvas');
- const Discord = require('discord.js')
- const fs = require('fs')
- // dimensão da imagem
- const canvas = Canvas.createCanvas(2000, 1495);
- // cria a imagem
- const ctx = canvas.getContext('2d');
- // Selecione a cor do traço
- ctx.strokeStyle = '#74037b';
- // Desenhe um retângulo com as dimensões de toda a tela
- ctx.strokeRect(0, 0, canvas.width, canvas.height);
- ctx.font = '81px montserrat medium';
- ctx.fillStyle = '#ffffff';
- ctx.fillText("ImLuan_", 440, 280);
- const widthName = ctx.measureText("ImLuan_")
- ctx.font = '49px montserrat thin'
- ctx.fillText("#" + "5130", 440 + widthName.width, 290);
- ctx.font = '50px montserrat extralight';
- ctx.fillStyle = '#ffffff';
- ctx.fillText("LVL.", 159, 668);
- const widthNamea = ctx.measureText("LVL.")
- ctx.font = '70px montserrat medium'
- ctx.fillText(" 3", 159 + widthNamea.width, 668);
- ctx.font = '60pt montserrat semibold';
- ctx.fillStyle = '#ffffff';
- ctx.fillText("3234", 160, 790);
- const widthNameb = ctx.measureText("3234")
- ctx.font = '50px montserrat extralight'
- ctx.fillText("xp", 160 + widthNameb.width, 790);
- // // Selecione o tamanho da fonte e digite uma das fontes disponíveis nativamente
- // ctx.font = '81px montserrat medium';
- // // Selecione o estilo que será usado para preencher o texto
- // ctx.fillStyle = '#ffffff';
- // ctx.fillText(message.author.username, 440, 280);
- const x = 41;
- const y = 36;
- const s = 349;
- ctx.fillStyle = 'red';
- ctx.beginPath()
- ctx.arc(x + (s / 2), y + (s / 2), s / 2, 0, 2 * Math.PI);
- ctx.fill()
- ctx.closePath();
- ctx.clip();
- // const WIDTH = 668, HEIGHT = 500
- const avatar = await Canvas.loadImage("https://cdn.discordapp.com/avatars/425997349135843328/4824dece3078e12de96b914c1f7bcca4.png?size=2048");
- ctx.drawImage(avatar, 41, 36, 350, 350);
- const background = await Canvas.loadImage('./imagens/perfil.png');
- ctx.drawImage(background, 0, 0, canvas.width, canvas.height);
- const buff = canvas.toBuffer()
- fs.writeFileSync("imagem.png", buff)
- console.log('opa')
- // const attachment = new Discord.Attachment(canvas.toBuffer(), 'welcome-image.png');
- // message.channel.send(attachment)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement