42
rated 0 times
[
48]
[
6]
/ answers: 1 / hits: 44277
/ 6 Years ago, sun, november 11, 2018, 12:00:00
I'm trying to make a userinfo
command, and I'm currently stuck on showing roles of the user.
Here is my code:
const Discord = module.require('discord.js');
const moment = require('moment');
module.exports.run = async (bot, message, args) => {
let user = message.mentions.users.first() || message.author;
const joinDiscord = moment(user.createdAt).format('llll');
const joinServer = moment(user.joinedAt).format('llll');
let embed = new Discord.RichEmbed()
.setAuthor(user.username + '#' + user.discriminator, user.displayAvatarURL)
.setDescription(`${user}`)
.setColor(`RANDOM`)
.setThumbnail(`${user.displayAvatarURL}`)
.addField('Joined at:', `${moment.utc(user.joinedAt).format('dddd, MMMM Do YYYY, HH:mm:ss')}`, true)
.addField('Status:', user.presence.status, true)
.addField('Roles:', user.roles.map(r => `${r}`).join(' | '), true)
.setFooter(`ID: ${user.id}`)
.setTimestamp();
message.channel.send({ embed: embed });
return;
}
module.exports.help = {
name: 'userinfo'
}
I'm getting this error TypeError: Cannot read property 'map' of undefined
and I don't know how to fix it?
More From » bots