Reputation: 11
please help, how to mention the user in the message? I can't find the answer on the internet. my code:
const exampleeEmbedd = new MessageEmbed()
.setColor('#53db56')
.setTitle(' [👋] Приветствуем нового путника!')
.setDescription(' Приветствуем вас ' + /*MENTION*/ + '!\nДобро пожаловать на международный сервер режима Geopolitics. \nЗдесь вы можете присоеденится к существующему городу/государству, либо зарегистрировать свой город/государство.')
.setURL('')
.setAuthor('👑Имперский Бот👑', 'https://images-ext-2.discordapp.net/external/nWASMV-67mx7guRheeUpvyD_cb6X2NkxUMH4PtbweyA/%3Fsize%3D512/https/cdn.discordapp.com/avatars/916617120064884796/5028d4861b407575072686657b3c2e9a.png' )
.setThumbnail(user.avatarURL())
.addFields(
)
.setImage('')
.setTimestamp()
.setFooter('asdas', 'https://images-ext-2.discordapp.net/external/nWASMV-67mx7guRheeUpvyD_cb6X2NkxUMH4PtbweyA/%3Fsize%3D512/https/cdn.discordapp.com/avatars/916617120064884796/5028d4861b407575072686657b3c2e9a.png');
mess.channel.send( { embeds: [exampleeEmbedd] } );
Upvotes: 0
Views: 139
Reputation:
You need to use a ${user}
string or ${user.tag}
, so your bot will mention a user.
Make sure you placed let user = message.mentions.members.first()
above the embed
The example:
const exampleeEmbed = new MessageEmbed()
.setTitle('an embed')
.setDescription(`Hello ${user}!`)
mess.channel.send({ embeds: exampleeEmbed });
Also make sure you enclose your message as ``
Upvotes: 1
Reputation: 335
Discord.js converts mentions for you automatically when interpreted as a string.
"Foo" + user + "Bar"
converts to Foo<@!1234567890>Bar
.
Using template strings:
`Foo${user}Bar`
In cases where you only have the user ID, you can do this manually:
"Foo<@!" + userId + ">Bar"
// or
`Foo<@!${userId}>Bar`
Ensure that userId
is a string.
Upvotes: 2