No discord user id mention in embed

So i've connected my bot into my FiveM server and when mentioning players on discord with there discordID in embed
const express = require('express');
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const bodyParser = require('body-parser');

const app = express();
const PORT = 3000;
const channelID = "1317635852104634388";

app.use(bodyParser.json());

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});

client.once('ready', () => {
console.log(`Bot connecté en tant que ${client.user.tag}`);
});

let activeMessages = {};

app.post('/service', async (req, res) => {
const { action, playerName, discordID, startTime, endTime, source } = req.body;
const channel = client.channels.cache.get(channelID);
if (!channel) return res.status(500).send("Canal Discord introuvable.");


if (action === "start") {
const embed = new EmbedBuilder()
.setColor(0xFFFFFF)
.setAuthor({ name:`<@${discordID}>` })
.addFields(
{ name: "Début de service", value: `\`\`\`${startTime}\`\`\``, inline: true },
{ name: "Fin de service", value: `\`\`\`-\`\`\``, inline: true }
);

const message = await channel.send({ embeds: [embed] });
activeMessages[source] = message.id;
res.send({ status: "Début de service enregistré." });

} else if (action === "end") {
const messageId = activeMessages[source];
if (messageId) {
const message = await channel.messages.fetch(messageId);
if (message) {
const updatedEmbed = EmbedBuilder.from(message.embeds[0])
.setColor(0xFFFFFF)
.spliceFields(1, 1, { name: "Fin de service", value: `\`\`\`${endTime}\`\`\``, inline: true });

await message.edit({ embeds: [updatedEmbed] });
delete activeMessages[source];
res.send({ status: "Fin de service enregistré." });
}
}
} else {
res.status(400).send("Action invalide.");
}
});

app.listen(PORT, () => {
console.log(`Serveur HTTP en écoute sur le port ${PORT}`);
});

client.login("
");


const express = require('express');
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const bodyParser = require('body-parser');

const app = express();
const PORT = 3000;
const channelID = "1317635852104634388";

app.use(bodyParser.json());

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});

client.once('ready', () => {
console.log(`Bot connecté en tant que ${client.user.tag}`);
});

let activeMessages = {};

app.post('/service', async (req, res) => {
const { action, playerName, discordID, startTime, endTime, source } = req.body;
const channel = client.channels.cache.get(channelID);
if (!channel) return res.status(500).send("Canal Discord introuvable.");


if (action === "start") {
const embed = new EmbedBuilder()
.setColor(0xFFFFFF)
.setAuthor({ name:`<@${discordID}>` })
.addFields(
{ name: "Début de service", value: `\`\`\`${startTime}\`\`\``, inline: true },
{ name: "Fin de service", value: `\`\`\`-\`\`\``, inline: true }
);

const message = await channel.send({ embeds: [embed] });
activeMessages[source] = message.id;
res.send({ status: "Début de service enregistré." });

} else if (action === "end") {
const messageId = activeMessages[source];
if (messageId) {
const message = await channel.messages.fetch(messageId);
if (message) {
const updatedEmbed = EmbedBuilder.from(message.embeds[0])
.setColor(0xFFFFFF)
.spliceFields(1, 1, { name: "Fin de service", value: `\`\`\`${endTime}\`\`\``, inline: true });

await message.edit({ embeds: [updatedEmbed] });
delete activeMessages[source];
res.send({ status: "Fin de service enregistré." });
}
}
} else {
res.status(400).send("Action invalide.");
}
});

app.listen(PORT, () => {
console.log(`Serveur HTTP en écoute sur le port ${PORT}`);
});

client.login("
");


then it gives me something like this <@user_id> and not @user_id discord.js version = `-- [email protected] node version = v22.12.0
7 Replies
d.js toolkit
d.js toolkit3d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
d.js docs
d.js docs3d ago
Some parts of an embed will not properly resolve mentions (leave them in the <@348607796335607817> format): - Author name - Footer text - Embed title - Embed field name
NyR
NyR3d ago
Also keep in mind that mentions inside embed don't actually ping the users
Ali
AliOP3d ago
yes it does
No description
NyR
NyR3d ago
That's not the author field though
Ali
AliOP3d ago
ohhh right and wich field is that please is it Embed title ?
NyR
NyR3d ago
Looks like description Do note that I have seen mentions resolve in embed title and field name but I believe that behaves differently, it resolve in mobile devices but not on desktops, it might have changed since then but you get the jist
Want results from more Discord servers?
Add your server