cyliim
cyliim

Reputation: 301

message.author.joinedAt outputs undefined when trying to use in an embed

As my title said, I'm trying to add a section to my userinfo command for when the user joined the guild. I've looked in the docs and found .joinedAt, so I tried adding it into my code. Whenever I execute the command, it just reads as undefined
Here's my code:

var userinf = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setThumbnail(message.author.avatarURL)
.setDescription("Guild: " + message.guild)
.setColor(0x333333)
.addField("Full Username: ", `${message.author.username}#${message.author.discriminator}`, true)
.addField("ID:", message.author.id, true)
.addField('Current Nickname: ', message.author.toString(), true)
.addField("Current Status: ", status[message.author.presence.status], true)
.addField("Currently Playing: ", message.author.presence.game || "Nothing", true)
.addField("Joined On: ", message.author.joinedAt, true)
.addField("Account Type: ", bot[message.author.bot], true)
.addField("Created On: ", newDate, true)
.setFooter("Created by Brickman#4669", client.user.avatarURL)

My ideal output would be it stating the date and time the user joined, where I can stylize it later.

Upvotes: 1

Views: 3847

Answers (1)

slothiful
slothiful

Reputation: 5623

joinedTimestamp and joinedAt are both properties of a GuildMember, not a User. Use message.member.joinedAt or message.member.joinedTimestamp.

I'd suggest checking out the Discord.js docs here.

Upvotes: 1

Related Questions