When I was coding a guildMemberAdd and a guildMemberRemove I ran across an issue... So, I was wondering, how do you obtain the user's username and discriminator from when they join? as when I tried member.username
and member.discriminator
it logs as undefined
and undefined
Code below, nothing was printed to console upon this issue:
exports.run = (client, member) => {
member.guild.channels.find(`name`, `mod-logs`).send({embed: {
"color": 8311585,
"footer": {
"text": "Bot made by: Pawxeric#0858"
},
"author": {
"name": "New Member",
"icon_url": member.avatarURL
},
"fields": [
{"name": `${member.username}#${member.discriminator}`, // logs as undefined#undefined
"value": "Joined"}
]
}});
}
Also, the code is having issues picking up anything that uses the member
value. Like avatarURL
, username
, and discriminator
. If there's something I'm missing, please share down below :3c
When I was coding a guildMemberAdd and a guildMemberRemove I ran across an issue... So, I was wondering, how do you obtain the user's username and discriminator from when they join? as when I tried member.username
and member.discriminator
it logs as undefined
and undefined
Code below, nothing was printed to console upon this issue:
exports.run = (client, member) => {
member.guild.channels.find(`name`, `mod-logs`).send({embed: {
"color": 8311585,
"footer": {
"text": "Bot made by: Pawxeric#0858"
},
"author": {
"name": "New Member",
"icon_url": member.avatarURL
},
"fields": [
{"name": `${member.username}#${member.discriminator}`, // logs as undefined#undefined
"value": "Joined"}
]
}});
}
Also, the code is having issues picking up anything that uses the member
value. Like avatarURL
, username
, and discriminator
. If there's something I'm missing, please share down below :3c
-
Are you sure that
member.guild.channels.find(`name`, `mod-logs`)
is returning something? Also, you don't need backticks " ` " here because you aren't utilizing variables. You might as well use double quotes. – zero298 Commented Jul 18, 2018 at 22:24
1 Answer
Reset to default 5I think you want to get properties from a user object
<member>.user
User has username, discriminator and avatarurl.
The full object can be found on https://discord.js/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744228424a4564122.html
评论列表(0条)