I'm making a userinfo command for my Discord bot and the line supposed to show me the date when the user joined shows me the date of today.
Here's my code
let user = interaction.options.getUser("user") || interaction.member.user;
const target = await interaction.guild.members.fetch(interaction.tagetId);
const Embed = new Discord.MessageEmbed()
.setColor(interaction.member.displayHexColor)
.setDescription(`**Informations ${user.username}**`)
.setThumbnail(user.displayAvatarURL({dynamic: true}))
.addField(`Username`, `${user.tag}`, true)
.addField(`ID`, `${user.id}`, true)
.addField(`Member since`, `${moment.utc(user.joinedAt).format("LL")}`)
.addField(`Joined Discord on`, moment(user.createdAt).format("LL"))
.setFooter(`Command used by ${interaction.member.user.username}`, interaction.member.user.displayAvatarURL({dynamic: 'true'}));
Does somebody know how to do to have the real join date ?
CodePudding user response:
let user = interaction.options.getUser("user") || interaction.member.user;
const target = await interaction.guild.members.fetch(interaction.tagetId);
const Embed = new Discord.MessageEmbed()
.setColor(interaction.member.displayHexColor)
.setDescription(`**Informations ${user.username}**`)
.setThumbnail(user.displayAvatarURL({dynamic: true}))
.addField(`Username`, `${user.tag}`, true)
.addField(`ID`, `${user.id}`, true)
.addField(`Member since`, `${moment.utc(user.joinedAt).format("LL")}`)
.addField(`Joined Discord on`, moment(user.createdAt).format("LL"))
.addField(`Server Joined on`, moment.utc(user.joinedAt).format('DD/MM/YY'))
.setFooter(`Command used by ${interaction.member.user.username}`, interaction.member.user.displayAvatarURL({dynamic: 'true'}));
CodePudding user response:
have you put
Flags.GUILD_MEMBERS
or
const client = new Discord.Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS"] });
or something like that in your intents in index.js