const Discord = require('discord.js');
const strftime = require('strftime');
module.exports = {
name: 'profile',
description: 'Get the profile of the tagged user, or your own profile.',
execute(message) {
const member = message.mentions.users.first(); // Тут ошибка
let argsUser
if (!member) argsUser = message.author
else argsUser = member.user
let statuses = {
online: 'Онлайн',
idle: 'Не активен',
dnd: 'Не беспокоить',
offline: 'Оффлайн'
}
let game
if(!argsUser.presence.game) game = `**${statuses[argsUser.presence.status]}**`
else if (argsUser.presence.game.type == 0) game = `Играет в **${argsUser.presence.game.name}**`
else if (argsUser.presence.game.type == 1) game = `Стримит [**${argsUser.presence.game.name}**](${argsUser.presence.game.url})`
else if (argsUser.presence.game.type == 2) game = `Слушает **${argsUser.presence.game.name}**`
else if (argsUser.presence.game.type == 3) game = `Смотрит **${argsUser.presence.game.name}**`
let day = 1000 * 60 * 60 * 24
let date1 = new Date(message.createdTimestamp)
let date2 = new Date(argsUser.createdTimestamp)
let date3 = new Date(message.guild.member(argsUser).joinedTimestamp)
let diff1 = Math.round(Math.abs((date1.getTime() - date2.getTime()) / day)) // С момента регистрации
let diff2 = Math.round(Math.abs((date1.getTime() - date3.getTime()) / day)) // С момента вступления на сервер
let pembed = new Discord.MessageEmbed()
.setTitle('Профиль участника ' + argsUser.username)
.addField('Статус:', game)
.addField('ID:', argsUser.id)
.addField('Дата регистрации:', `${strftime('%d.%m.%Y', new Date(argsUser.createdTimestamp))}\n(${diff1} дн. назад)`, true)
.addField('Дата вступления:', `${strftime('%d.%m.%Y', new Date(message.guild.member(argsUser).joinedTimestamp))}\n(${diff2} дн. назад)`, true)
.addField('Роли:', message.guild.member(argsUser).roles.cache.filter(r => r.id !== message.guild.id).map(r => r).join(", ") || 'Нет')
.setColor(message.guild.member(argsUser).displayHexColor)
.setTimestamp()
.setThumbnail(argsUser.avatarURL())
message.channel.send(pembed)
},
};
TypeError: Cannot read property 'member' of undefined
at Object.execute (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\commands\profile.js:6:30)
at Client. (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\index.js:141:11)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\Кирилл\Documents\Дискорд боты\crazy-bot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)