Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
El nombre de usuario y el número de miembros no se actualizarán: Discord.js y canvas

¡Oye!

Hice un bot con canvas y Discord.js v13 que automáticamente escribe un mensaje de bienvenida.

Esto funciona hasta ahora sin ningún problema. Pero si un segundo usuario se une al servidor, solo se actualizará la imagen de perfil y no el nombre.

¿Cómo podría arreglar esto? ¡Gracias por tu ayuda!


Aquí está mi código que estoy usando y algunas imágenes de muestra. (por favor ignore el formato incorrecto ^^)

Enlace a las imágenes: https://imgur.com/a/h4NIgGC

 const Discord = require("discord.js") const Canvas = require("canvas") bot.on("guildMemberAdd", async (member) => { var welcomeCanvas = {}; welcomeCanvas.create = Canvas.createCanvas(1024, 500) welcomeCanvas.context = welcomeCanvas.create.getContext("2d") welcomeCanvas.context.font = 'bold 72px Arial'; welcomeCanvas.context.fillStyle = "#ffffff"; Canvas.loadImage("https://www.misspompadour.de/media/cb/23/bb/1635526572/painting-the-past-persian-grey-kreidefarbe-farbe-wand-ansicht.jpg").then(async (img) => { welcomeCanvas.context.drawImage(img, 0, 0, 1024, 500) welcomeCanvas.context.fillText("WELCOME", 260, 360); welcomeCanvas.context.beginPath(); welcomeCanvas.context.arc(512, 166, 128, 0, Math.PI * 2, true); welcomeCanvas.context.stroke(); welcomeCanvas.context.fill() }) const welcomechannel = bot.channels.cache.get("913099401721950259") let canvas = welcomeCanvas; canvas.context.font = " bold 42px Arial"; canvas.context.textAlign = "center"; canvas.context.fillText(member.user.tag.toLocaleUpperCase(), 512, 415) canvas.context.font = "bold 32px Arial"; canvas.context.fillText(`WE ARE NOW ${member.guild.memberCount} MEMBERS`, 512, 465) canvas.context.beginPath(); canvas.context.arc(512, 166, 119, 0, Math.PI * 2, true) canvas.context.closePath() canvas.context.clip() await Canvas.loadImage(member.user.displayAvatarURL({ format: 'png', size: 1024 })) .then(img => { canvas.context.drawImage(img, 393, 47, 238, 238); }) let attachment = new Discord.MessageAttachment(canvas.create.toBuffer(), `welcome-${member.user.id}.png`) welcomechannel.send({ files: [attachment] }); }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!