Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
Sudo command (discord.js)

Im trying to make a sudo command but the user i mention in args 0's Profile picture wont show.

async execute(client, message, args) {
    if (!message.member.hasPermission("MANAGE_WEBHOOKS")) {
            return message.channel.send(`You don't have permission to execute this command.`)}
    message.delete();
    let user =
    message.mentions.members.first() ||
    message.guild.members.cache.get(args[0]) ||
    message.member.id();
    if (!user) return message.channel.send("Please provide a user!");
    const webhook = await message.channel.createWebhook(user.displayName, {
    avatar: user.user.displayAvatarURL(),
    channel: message.channel.id
    });
    await webhook.send(args.slice(1).join(" ")).then(() => {
    webhook.delete();
    });
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

A couple of things:

  1. Your declaration of user (let user =) is a bit misleading when you are fetching a member object from the cache. I would recommend changing it to member instead for coherency.

  2. Smallketchup82 is correct. Because you are getting a member object you would need to use the .user attribute to get anything pertaining to the user portion (username, tag, discriminator, and avatar).

If you were to follow the above advice you could do something like:

avatar: member.user.avatarURL()

I'm not entirely sure of which method gets the user's avatar as I have only worked with discordjs v13. However, its most likely one of the two:

  • member.user.displayAvatarURL()
  • member.user.avatarURL()
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda