I would like to list server members on Discord using discord.js library. However, some (mostly inactive) users are displayed in form <@123456789123456789> (their id) instead of @Michal (their clickable name with user profile).
It can be because some members are uncached? I tried fetch all members before printing them, even with force option. But without success.
const executeCommand = async (client, message) => {
const members = await message.guild.members.fetch({ force: true })
message.channel.send({ embed: {
title: 'Members',
description: members.map(m => `<@${m.id}>`).join(', ')
} })
}
Also both Presence intent and Server member intent are enabled on my bot. How can I fix it?