Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

271
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda