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

201
Views
How to mention a user in a command

I don't know how to make a command to interact with a user by mentioning with this command structure

I know it is not possible as the command is currently

const Discord = require("discord.js");

const Discord = require("discord.js");

module.exports = new Command({
    name: "avatar",
    permission: "SEND_MESSAGES",
    async run(message) {
        const user = message.mentions.users.first() || message.author;
        const avatarEmbed = new Discord.MessageEmbed();

        user
        avatarEmbed
            .setColor("FF0000")
            .setAuthor(message.author.username)
            .setImage(message.author.avatarURL({ dynamic: true }))


        message.channel.send({embeds: [avatarEmbed]});

    }
});

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

try this


const Discord = require("discord.js");

const Discord = require("discord.js");

module.exports = new Command({
    name: "avatar",
    permission: "SEND_MESSAGES",
    async run(message) {
        const user = message.mentions.users.first() || message.author;
        const avatarEmbed = new Discord.MessageEmbed();

        avatarEmbed
            .setColor("FF0000")
            .setAuthor(message.author.username)
            .setImage(message.author.avatarURL({ dynamic: true }))


        message.channel.send({ content: `<@${user.id}>`, embeds: [avatarEmbed]});

    }
});
about 4 years ago · Juan Pablo Isaza Report

0

You can just pass the object directly and discord.js will manage it. Or you can go with the raw method

`<@{user.id}>`
`<@!{user.id}>`

or

`${user}` // discord.js will do the rest

But, either way, it will work

about 4 years ago · Juan Pablo Isaza Report
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!