Mentioning users showing as unknown-user

const result = await User.find(
{ guildId: guildId }
);
let userDiscordIds = [];
console.log(result);
result.forEach((item) => {
if (item.discordUserId.toString().length > 1)
userDiscordIds.push(item.discordUserId)

})
console.log(userDiscordIds);
const userString = userDiscordIds.map(element => `<@${element}>` ).join(' ');
console.log(userString);
interaction.reply({content: userString, embeds: [embedUserList(result)] });
const result = await User.find(
{ guildId: guildId }
);
let userDiscordIds = [];
console.log(result);
result.forEach((item) => {
if (item.discordUserId.toString().length > 1)
userDiscordIds.push(item.discordUserId)

})
console.log(userDiscordIds);
const userString = userDiscordIds.map(element => `<@${element}>` ).join(' ');
console.log(userString);
interaction.reply({content: userString, embeds: [embedUserList(result)] });
[
222417559352377340,
297103672653905900,
464155591498006500,
319250593958854660,
199347376874323970
]
<@222417559352377340> <@297103672653905900> <@464155591498006500> <@319250593958854660> <@199347376874323970>
[
222417559352377340,
297103672653905900,
464155591498006500,
319250593958854660,
199347376874323970
]
<@222417559352377340> <@297103672653905900> <@464155591498006500> <@319250593958854660> <@199347376874323970>
These users are in the same server as the bot
No description
5 Replies
d.js toolkit
d.js toolkit3w 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!
space
space3w ago
Are those ids really all ending with a 0? That looks suspiciously like rounding errors, which would explain why mentioning the users fails.
sb
sbOP3w ago
hmm let me check you're right.. my id is 199347376874323968 I guess some incrementing is happening on the ids 🤣 hmm some have also decremented like 222417559352377344 has become 222417559352377340 weird
space
space3w ago
That’s likely because they are somewhere converted to a number (maybe in your db driver). Try investigating how to save them as bigints without the number conversion, or just save them as text.
sb
sbOP3w ago
Yeah, it's to do with precision because the number is too big string seems to be the way sneaky

Did you find this page helpful?