reformat to fit templating, needs some work still

This commit is contained in:
Erik 2020-04-19 22:53:36 +03:00
parent 23c75290c7
commit d971e126db

View File

@ -17,9 +17,8 @@ class UserCommand extends Command {
}
async execute(message, { args, params }) {
async execute(message, { params }) {
console.log(args, params);
let search = params[0] ? params[0].toLowerCase() === 'search' : false;
let response = '';
if(search && params.length > 1) {
@ -39,13 +38,11 @@ class UserCommand extends Command {
}
response = {
embed: {
description: response,
title: `Search result for keyword: \`${key}\``,
color: 0x0088cc,
footer: {
text: `Found ${members.size} matches, displaying ${count}`
}
description: response,
title: `Search result for keyword: \`${key}\``,
color: 0x0088cc,
footer: {
text: `Found ${members.size} matches, displaying ${count}`
}
};
@ -55,28 +52,29 @@ class UserCommand extends Command {
if(!user) return message.respond('No user found.');
let member = await message.guild.members.fetch(user.id).catch(console.error);
response = message.format('C_USER', {
nickname: member && member.nickname ? member.nickname : 'N/A',
id: user.id,
joined: member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A',
created: user.createdAt.toDateString(),
status: user.presence.status,
activity: user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A',
serverActivity: member && member.lastMessage ? member.lastMessage.createdAt.toDateString() : 'N/A',
globalActivity: user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A',
roles: member ? member.roles.cache.filter(r => r.name !== '@everyone').map(r => r.name).join(', ') : 'N/A'
});
response = {
embed: {
title: `**${user.tag}** (${user.id})`,
description: stripIndents`
**Nickname:** ${member && member.nickname ? member.nickname : 'N/A'}
**User:** <@${user.id}>
**Server join date:** ${member && member.joinedAt ? member.joinedAt.toDateString() : 'N/A'}
**Account created:** ${user.createdAt.toDateString()}
**Status:** ${user.presence.status}
**Activity:** ${user.presence.activities.length > 0 ? user.presence.activities[0].name : 'N/A' }
**Last server activity:** ${member && member.lastMessage ? member.lastMessage.createdAt.toDateString() : 'N/A' }
**Last global activity:** ${user.lastMessage ? user.lastMessage.createdAt.toDateString() : 'N/A'}
${member ? `**Roles:** ${member.roles.cache.filter(r=>r.name !== '@everyone').map(r=>r.name).join(', ')}` : '' }
`,
thumbnail: {
url: user.avatarURL() || user.defaultAvatarURL
}
title: `**${user.tag}** (${user.id})`,
description: response,
thumbnail: {
url: user.avatarURL() || user.defaultAvatarURL
}
};
}
return message.respond(response);
return message.embed(response);
}